home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / dev / obero / Interfaces3_4.lha / Interfaces / Dos.mod < prev    next >
Text File  |  1994-03-20  |  86KB  |  1,921 lines

  1. (*
  2. (*
  3. **  Amiga Oberon Interface Module:
  4. **  $VER: Dos.mod 40.15 (10.1.94) Oberon 3.2
  5. **
  6. **   © 1993 by Fridtjof Siebert
  7. **   updated for V39, V40 by hartmut Goebel
  8. *)
  9. *)
  10.  
  11. MODULE Dos;
  12.  
  13. IMPORT
  14.   e * := Exec,
  15.   t * := Timer,
  16.   u * := Utility,
  17.   y * := SYSTEM;
  18.  
  19.  
  20. CONST
  21.   dosName * = "dos.library";
  22.   DOSTRUE * = e.LTRUE;
  23.   DOSFALSE * = e.LFALSE;
  24.  
  25. (* Mode parameter to Open() *)
  26.   oldFile    * =  1005;  (* Open existing file read/write
  27.                           * positioned at beginning of file. *)
  28.   newFile    * =  1006;  (* Open freshly created file (delete
  29.                           * old file) read/write, exclusive lock. *)
  30.   readWrite  * =  1004;  (* Open old file w/shared lock,
  31.                           * creates file if doesn't exist. *)
  32.  
  33. (* Relative position to Seek() *)
  34.   beginning  * =  -1;      (* relative to Begining Of File *)
  35.   current    * =   0;      (* relative to Current file position *)
  36.   end        * =   1;      (* relative to End Of File    *)
  37.  
  38.   bitsPerByte     * =  8;
  39.   bytesPerLong    * =  4;
  40.   bitsPerLong     * =  32;
  41.   maxInt          * =  7FFFFFFFH;
  42.   minInt          * =  80000000H;
  43.  
  44. (* Passed as type to Lock() *)
  45.   sharedLock      * =  -2;    (* File is readable by others *)
  46.   accessRead      * =  -2;    (* Synonym *)
  47.   exclusiveLock   * =  -1;    (* No other access allowed    *)
  48.   accessWrite     * =  -1;    (* Synonym *)
  49.  
  50.  
  51. TYPE
  52.  
  53.   DatePtr                 * = UNTRACED POINTER TO Date;
  54.   FileInfoBlockPtr        * = UNTRACED POINTER TO FileInfoBlock;
  55.   InfoDataPtr             * = UNTRACED POINTER TO InfoData;
  56.   DateTimePtr             * = UNTRACED POINTER TO DateTime;
  57.   AnchorPathPtr           * = UNTRACED POINTER TO AnchorPath;
  58.   AChainPtr               * = UNTRACED POINTER TO AChain;
  59.   ProcessPtr              * = UNTRACED POINTER TO Process;
  60.   DosPacketPtr            * = UNTRACED POINTER TO DosPacket;
  61.   StandardPacketPtr       * = UNTRACED POINTER TO StandardPacket;
  62.   ErrorStringPtr          * = UNTRACED POINTER TO ErrorString;
  63.   DosLibraryPtr           * = UNTRACED POINTER TO DosLibrary;
  64.   RootNodePtr             * = UNTRACED POINTER TO RootNode;
  65.   CliProcListPtr          * = UNTRACED POINTER TO CliProcList;
  66.   AssignListPtr           * = UNTRACED POINTER TO AssignList;
  67.   DevProcPtr              * = UNTRACED POINTER TO DevProc;
  68.   ExAllDataPtr            * = UNTRACED POINTER TO ExAllData;
  69.   ExAllControlPtr         * = UNTRACED POINTER TO ExAllControl;
  70.   DeviceNodePtr           * = UNTRACED POINTER TO DeviceNode;
  71.   NotifyMessagePtr        * = UNTRACED POINTER TO NotifyMessage;
  72.   NotifyRequestPtr        * = UNTRACED POINTER TO NotifyRequest;
  73.   CSourcePtr              * = UNTRACED POINTER TO CSource;
  74.   RDArgsPtr               * = UNTRACED POINTER TO RDArgs;
  75.   RecordLockPtr           * = UNTRACED POINTER TO RecordLock;
  76.   LocalVarPtr             * = UNTRACED POINTER TO LocalVar;
  77.   SegmentPtr              * = UNTRACED POINTER TO Segment;
  78.   DosListNodePtr          * = UNTRACED POINTER TO DosListNode;
  79.   DeviceListAPtr          * = UNTRACED POINTER TO DeviceList;
  80.   DevInfoAPtr             * = UNTRACED POINTER TO DevInfo;
  81.   DosListAPtr             * = UNTRACED POINTER TO DosList;
  82.   CommandLineInterfaceAPtr* = UNTRACED POINTER TO CommandLineInterface;
  83.   FileLockPtr             * = BPOINTER TO FileLock;
  84.   FileHandlePtr           * = BPOINTER TO FileHandle;
  85.   DosEnvecPtr             * = BPOINTER TO DosEnvec;
  86.   DeviceListPtr           * = BPOINTER TO DeviceList;
  87.   DevInfoPtr              * = BPOINTER TO DevInfo;
  88.   DosListPtr              * = BPOINTER TO DosList;
  89.   CommandLineInterfacePtr * = BPOINTER TO CommandLineInterface;
  90.   TaskArrayPtr            * = BPOINTER TO TaskArray;
  91.   DosInfoPtr              * = BPOINTER TO DosInfo;
  92.   FileSysStartupMsgPtr    * = BPOINTER TO FileSysStartupMsg;
  93.   PathLockPtr             * = BPOINTER TO PathLock;
  94.  
  95.   Date * = STRUCT
  96.     days * : LONGINT;          (* Number of days since Jan. 1, 1978 *)
  97.     minute * : LONGINT;        (* Number of minutes past midnight *)
  98.     tick * : LONGINT;          (* Number of ticks past minute *)
  99.   END;
  100.  
  101. CONST
  102.   ticksPerSecond * = 50;       (* Number of ticks in one second *)
  103.  
  104. TYPE
  105.  
  106. (* Returned by Examine() and ExNext(), must be on a 4 byte boundary *)
  107.   FileInfoBlock * = STRUCT
  108.     diskKey * : LONGINT;
  109.     dirEntryType * : LONGINT;       (* Type of Directory. If < 0, then a plain file.
  110.                                      * If > 0 a directory *)
  111.     fileName * : ARRAY 108 OF CHAR; (* Null terminated. Max 30 chars used for now *)
  112.     protection * : LONGSET;         (* bit mask of protection, rwxd are 3-0.      *)
  113.     entryType * : LONGINT;
  114.     size * : LONGINT;               (* Number of bytes in file *)
  115.     numBlock * : LONGINT;           (* Number of blocks in file *)
  116.     date * : Date;                  (* Date file last changed *)
  117.     comment * : ARRAY 80 OF CHAR;   (* Null terminated comment associated with file *)
  118.  
  119.    (* Note: the following fields are not supported by all filesystems.        *)
  120.    (* They should be initialized to 0 sending an ACTION_EXAMINE packet.       *)
  121.    (* When Examine() is called, these are set to 0 for you.           *)
  122.    (* AllocDosObject() also initializes them to 0.                    *)
  123.     ownerUID *: INTEGER;            (* owner's UID *)
  124.     ownerGID *: INTEGER;            (* owner's GID *)
  125.  
  126.     reserved * : ARRAY 32 OF CHAR;
  127.   END;
  128.  
  129. CONST
  130.  
  131. (* FileInfoBLock.protection flag definitions: *)
  132. (* Regular RWED bits are 0 == allowed. *)
  133. (* NOTE: GRP and OTR RWED permissions are 0 == not allowed! *)
  134. (* Group and Other permissions are not directly handled by the filesystem *)
  135.   otrRead    * = 15;  (* Other: file is readable *)
  136.   otrWrite   * = 14;  (* Other: file is writable *)
  137.   otrExecute * = 13;  (* Other: file is executable *)
  138.   otrDelete  * = 12;  (* Other: prevent file from being deleted *)
  139.   grpRead    * = 11;  (* Group: file is readable *)
  140.   grpWrite   * = 10;  (* Group: file is writable *)
  141.   grpExecute * =  9;  (* Group: file is executable *)
  142.   grpDelete  * =  8;  (* Group: prevent file from being deleted *)
  143.  
  144.   script   * = 6;        (* program is a script (execute) file *)
  145.   pure     * = 5;        (* program is reentrant and rexecutable *)
  146.   archive  * = 4;        (* cleared whenever file is changed *)
  147.   readProt * = 3;        (* ignored by old filesystem *)
  148.   writeProt* = 2;        (* ignored by old filesystem *)
  149.   execute  * = 1;        (* ignored by system, used by Shell *)
  150.   delete   * = 0;        (* prevent file from being deleted *)
  151.  
  152. (* Standard maximum length for an error string from fault.  However, most *)
  153. (* error strings should be kept under 60 characters if possible.  Don't   *)
  154. (* forget space for the header you pass in. *)
  155.   faultMax * = 82;
  156.  
  157. TYPE
  158.  
  159. (* All BCPL data must be long word aligned.  BCPL pointers are the long word
  160.  *  address (i.e byte address divided by 4 (>>2)) *)
  161.   BPTR * = e.BPTR;                   (* Long word pointer *)
  162.   BSTR * = BPOINTER TO e.STRING;     (* Long word pointer to BCPL string  *)
  163.  
  164. (* BCPL strings have a length in the first byte and then the characters.
  165.  * For example:  s[0]=3 s[1]=S s[2]=Y s[3]=S                             *)
  166.  
  167. TYPE
  168.  
  169. (* returned by Info(), must be on a 4 byte boundary *)
  170.   InfoData * = STRUCT
  171.     numSoftErrors * : LONGINT;   (* number of soft errors on disk *)
  172.     unitNumber    * : LONGINT;   (* Which unit disk is (was) mounted on *)
  173.     diskState     * : LONGINT;   (* See defines below *)
  174.     numBlock      * : LONGINT;   (* Number of blocks on disk *)
  175.     numBlockUsed  * : LONGINT;   (* Number of block in use *)
  176.     bytesPerBlock * : LONGINT;
  177.     diskType      * : LONGINT;   (* Disk Type code *)
  178.     volumeNode    * : DeviceListPtr; (* BCPL pointer to volume node *)
  179.     inUse         * : LONGINT;   (* Flag, zero if not in use *)
  180.   END;
  181.  
  182. CONST
  183.  
  184. (* InfoData.diskState *)
  185.   writeProtect * = 80;    (* Disk is write protected *)
  186.   validating   * = 81;    (* Disk is currently being validated *)
  187.   validated    * = 82;    (* Disk is consistent and writeable *)
  188.  
  189. (* InfoData.diskType *)
  190. (* Any other new filesystems should also, if possible. *)
  191.   noDiskPresent        * = -1;
  192.   unreadableDisk       * = y.VAL(LONGINT,'BAD\o');
  193.   dosDisk              * = y.VAL(LONGINT,'DOS\o');
  194.   ffsDisk              * = y.VAL(LONGINT,'DOS\x01');
  195.   interDosDisk         * = y.VAL(LONGINT,'DOS\x02');
  196.   interFFSDisk         * = y.VAL(LONGINT,'DOS\x03');
  197.   fastDirDosDisk       * = y.VAL(LONGINT,'DOS\x04');
  198.   fastDirFFSDisk       * = y.VAL(LONGINT,'DOS\x05');
  199.   notReallyDos         * = y.VAL(LONGINT,'NDOS' );
  200.   kickStartDisk        * = y.VAL(LONGINT,'KICK' );
  201.   msdosDisk            * = y.VAL(LONGINT,'MSD\o');
  202.  
  203. (* Errors from IoErr(), etc. *)
  204.   noFreeStore                * = 103;
  205.   taskTableFull              * = 105;
  206.   badTemplate                * = 114;
  207.   badNumber                  * = 115;
  208.   requiredArgMissing         * = 116;
  209.   keyNeedsArg                * = 117;
  210.   tooManyArgs                * = 118;
  211.   unmatchedQuotes            * = 119;
  212.   lineTooLong                * = 120;
  213.   fileNotObject              * = 121;
  214.   invalidResidentLibrary     * = 122;
  215.   noDefaultDir               * = 201;
  216.   objectInUse                * = 202;
  217.   objectExists               * = 203;
  218.   dirNotFound                * = 204;
  219.   objectNotFound             * = 205;
  220.   badStreamName              * = 206;
  221.   objectTooLarge             * = 207;
  222.   actionNotKnown             * = 209;
  223.   invalidComponentName       * = 210;
  224.   invalidLock                * = 211;
  225.   objectWrongType            * = 212;
  226.   diskNotValidated           * = 213;
  227.   diskWriteProtected         * = 214;
  228.   renameAcrossDevices        * = 215;
  229.   directoryNotEmpty          * = 216;
  230.   tooManyLevels              * = 217;
  231.   deviceNotMounted           * = 218;
  232.   seekError                  * = 219;
  233.   commentTooBig              * = 220;
  234.   diskFull                   * = 221;
  235.   deleteProtected            * = 222;
  236.   writeProtected             * = 223;
  237.   readProtected              * = 224;
  238.   notADosDisk                * = 225;
  239.   noDisk                     * = 226;
  240.   noMoreEntries              * = 232;
  241. (* added for 1.4 *)
  242.   isSoftLink                 * = 233;
  243.   objectLinked               * = 234;
  244.   badHunk                    * = 235;
  245.   notImplemented             * = 236;
  246.   recordNotLocked            * = 240;
  247.   lockCollision              * = 241;
  248.   lockTimeOut                * = 242;
  249.   unLockError                * = 243;
  250.  
  251. (* These are the return codes used by convention by AmigaDOS commands *)
  252. (* See FAILAT and IF for relvance to EXECUTE files                    *)
  253.   ok                    * =  0; (* No problems, success *)
  254.   warn                  * =  5; (* A warning only *)
  255.   error                 * = 10; (* Something wrong *)
  256.   fail                  * = 20; (* Complete or severe failure*)
  257.  
  258. (* Bit numbers that signal you that a user has issued a break *)
  259.   ctrlC  * = 12;
  260.   ctrlD  * = 13;
  261.   ctrlE  * = 14;
  262.   ctrlF  * = 15;
  263.  
  264. (* Values returned by SameLock() *)
  265.   same          * = 0;
  266.   sameHandler   * = 1;      (* actually same volume *)
  267.   different     * = -1;
  268.  
  269. (* types for ChangeMode() *)
  270.   changeLock  * = 0;
  271.   changeFH    * = 1;
  272.  
  273. (* Values for MakeLink() *)
  274.   hard   * = 0;
  275.   soft   * = 1;      (* softlinks are not fully supported yet *)
  276.  
  277. (* values returned by ReadItem *)
  278.   equal      * =  -2;              (* "=" Symbol *)
  279.   itemError  * =  -1;              (* error *)
  280.   nothing    * =  0;               (* *N, ;, endstreamch *)
  281.   unQuoted   * =  1;               (* unquoted item *)
  282.   quoted     * =  2;               (* quoted item *)
  283.  
  284. (* types for AllocDosObject/FreeDosObject *)
  285.   fileHandle      * = 0;      (* few people should use this *)
  286.   exAllControl    * = 1;      (* Must be used to allocate this! *)
  287.   fib             * = 2;      (* useful *)
  288.   stdpkt          * = 3;      (* for doing packet-level I/O *)
  289.   cli             * = 4;      (* for shell-writers, etc *)
  290.   rdArgs          * = 5;      (* for ReadArgs if you pass it in *)
  291.  
  292. TYPE
  293.  
  294. (*
  295.  *      Data structures and equates used by the V1.4 DOS functions
  296.  * StrtoDate() and DatetoStr()
  297.  *)
  298.  
  299. CONST
  300.  
  301. (* You need this much room for each of the DateTime strings: *)
  302.   lenDatString * = 16;
  303.  
  304. TYPE
  305.   DatString * = ARRAY 16 OF CHAR;
  306.   DatStringPtr * = UNTRACED POINTER TO DatString;
  307.  
  308. (*--------- String/Date structures etc *)
  309.   DateTime * = STRUCT (stamp * : Date)              (* DOS Date *)
  310.     format * : SHORTINT;            (* controls appearance of dat_StrDate *)
  311.     flags  * : SHORTSET;            (* see BITDEF's below *)
  312.     strDay * : DatStringPtr;        (* day of the week string *)
  313.     strDate* : DatStringPtr;        (* date string *)
  314.     strTime* : DatStringPtr;        (* time string *)
  315.   END;
  316.  
  317. CONST
  318.  
  319. (* flags for DateTime.flags *)
  320.  
  321.   subst   * = 0;              (* substitute Today, Tomorrow, etc. *)
  322.   future  * = 1;              (* day of the week is in future *)
  323.  
  324. (*
  325.  *      date format values
  326.  *)
  327.  
  328.   formatDos   * = 0;              (* dd-mmm-yy *)
  329.   formatInt   * = 1;              (* yy-mm-dd  *)
  330.   formatUSA   * = 2;              (* mm-dd-yy  *)
  331.   formatCDN   * = 3;              (* dd-mm-yy  *)
  332.   formatMax   * = formatCDN;
  333.  
  334.  
  335. (***********************************************************************
  336. ************************ PATTERN MATCHING ******************************
  337. ************************************************************************
  338.  
  339. * structure expected by MatchFirst, MatchNext.
  340. * Allocate this structure and initialize it as follows:
  341. *
  342. * Set ap_BreakBits to the signal bits (CDEF) that you want to take a
  343. * break on, or NULL, if you don't want to convenience the user.
  344. *
  345. * If you want to have the FULL PATH NAME of the files you found,
  346. * allocate a buffer at the END of this structure, and put the size of
  347. * it into ap_Length.  If you don't want the full path name, make sure
  348. * you set ap_Length to zero.  In this case, the name of the file, and stats
  349. * are available in the ap_Info, as per usual.
  350. *
  351. * Then call MatchFirst() and then afterwards, MatchNext() with this structure.
  352. * You should check the return value each time (see below) and take the
  353. * appropriate action, ultimately calling MatchEnd() when there are
  354. * no more files and you are done.  You can tell when you are done by
  355. * checking for the normal AmigaDOS return code ERROR_NO_MORE_ENTRIES.
  356. *
  357. *)
  358.  
  359. TYPE
  360.   AnchorPath * = STRUCT
  361.         base * : AChainPtr;        (* pointer to first anchor *)
  362.         last * : AChainPtr;        (* pointer to last anchor *)
  363.         breakBits * : LONGSET;     (* Bits we want to break on *)
  364.         foundBreak * : LONGSET;    (* Bits we broke on. Also returns ERROR_BREAK *)
  365.         flags * : SHORTSET;        (* New use for extra word. *)
  366.         reserved * : e.BYTE;
  367.         strLen * : INTEGER;        (* This is what AnchoPath.length used to be *)
  368.         info * : FileInfoBlock;
  369.         buf * : e.STRING;          (* Buffer for path name *)
  370.   END;
  371.  
  372. CONST
  373. (* AnchorPath.flags *)
  374.   doWild  * = 0;       (* User option ALL *)
  375.   itsWild * = 1;       (* Set by MatchFirst, used by MatchNext *)
  376.                        (* Application can test itsWild, too *)
  377.   doDir   * = 2;       (* Bit is SET if a DIR node should be *)
  378.                        (* entered. Application can RESET this *)
  379.                        (* bit after MatchFirst/MatchNext to AVOID *)
  380.                        (* entering a dir. *)
  381.   didDir  * = 3;       (* Bit is SET for an "expired" dir node. *)
  382.   noMemErr* = 4;       (* Set on memory error *)
  383.   doDot   * = 5;       (* If set, allow conversion of '.' to *)
  384.                        (* CurrentDir *)
  385.   dirChanged * = 6;    (* ap_Current->an_Lock changed *)
  386.                        (* since last MatchNext call *)
  387.  
  388. TYPE
  389.   AChain * = STRUCT
  390.         child  * : AChainPtr;
  391.         parent * : AChainPtr;
  392.         lock   * : FileLockPtr;
  393.         info   * : FileInfoBlock;
  394.         flags  * : SHORTSET;
  395.         string * : e.STRING;
  396.   END;
  397.  
  398. CONST
  399.  
  400.   patternBit  * = 0;
  401.   examinedBit * = 1;
  402.   completed   * = 2;
  403.   allBit      * = 3;
  404.   single      * = 4;
  405.  
  406. (*
  407.  * Constants used by wildcard routines, these are the pre-parsed tokens
  408.  * referred to by pattern match.  It is not necessary for you to do
  409.  * anything about these, MatchFirst() MatchNext() handle all these for you.
  410.  *)
  411.  
  412.   pAny           * = 80H;    (* Token for '*' or '#?  *)
  413.   pSingle        * = 81H;    (* Token for '?' *)
  414.   pOrStart       * = 82H;    (* Token for '(' *)
  415.   pOrNext        * = 83H;    (* Token for '|' *)
  416.   pOrEnd         * = 84H;    (* Token for ')' *)
  417.   pNot           * = 85H;    (* Token for '~' *)
  418.   pNotEnd        * = 86H;    (* Token for *)
  419.   pNotClass      * = 87H;    (* Token for '^' *)
  420.   pClass         * = 88H;    (* Token for '[]' *)
  421.   pRepBeg        * = 89H;    (* Token for '[' *)
  422.   pRepEnd        * = 8AH;    (* Token for ']' *)
  423.   pStop          * = 8BH;    (* Token to force end of evaluation *)
  424.  
  425. (* Values for an_Status, NOTE: These are the actual bit numbers *)
  426.  
  427.   complexBit   * = 1;       (* Parsing complex pattern *)
  428.   examineBit   * = 2;       (* Searching directory *)
  429.  
  430. (*
  431.  * Returns from MatchFirst(), MatchNext()
  432.  * You can also get dos error returns, such as ERROR_NO_MORE_ENTRIES,
  433.  * these are in the dos.h file.
  434.  *)
  435.  
  436.   bufferOverflow * = 303;     (* User or internal buffer overflow *)
  437.   break          * = 304;     (* A break character was received *)
  438.   notExecutable  * = 305;     (* A file has E bit cleared *)
  439.  
  440. TYPE
  441.  
  442.   ProcessId * = e.MsgPortPtr; (* Points to Process.msgPort *)
  443.  
  444. (* All DOS processes have this structure *)
  445. (* Create and Device Proc returns pointer to the MsgPort in this structure *)
  446. (* dev_proc = (struct Process * ) (DeviceProc(..) - sizeof(struct Task)); *)
  447.  
  448.   Process * = STRUCT (task * : e.Task)
  449.     msgPort        * : e.MsgPort;     (* This is BPTR address from DOS functions  *)
  450.     pad            * : INTEGER;       (* Remaining variables on 4 byte boundaries *)
  451.     segList        * : e.BPTR;        (* Array of seg lists used by this process  *)
  452.     stackSize      * : LONGINT;       (* Size of process stack in bytes           *)
  453.     globVec        * : e.APTR;        (* Global vector for this process (BCPL)    *)
  454.     taskNum        * : LONGINT;       (* CLI task number of zero if not a CLI     *)
  455.     stackBase      * : e.BPTR;        (* Ptr to high memory end of process stack  *)
  456.     result2        * : LONGINT;       (* Value of secondary result from last call *)
  457.     currentDir     * : FileLockPtr;   (* Lock associated with current directory   *)
  458.     cis            * : FileHandlePtr; (* Current CLI Input Stream                 *)
  459.     cos            * : FileHandlePtr; (* Current CLI Output Stream                *)
  460.     consoleTask    * : ProcessId;     (* Console handler process for current window*)
  461.     fileSystemTask * : ProcessId;     (* File handler process for current drive   *)
  462.     cli            * : CommandLineInterfacePtr;  (* pointer to CommandLineInterface          *)
  463.     returnAddr     * : e.APTR;        (* pointer to previous stack frame          *)
  464.     pktWait        * : e.APTR;        (* Function to be called when awaiting msg  *)
  465.     windowPtr      * : e.APTR;        (* Window for error printing                *)
  466.  
  467.     (* following definitions are new with 2.0 *)
  468.     homeDir        * : FileLockPtr;   (* Home directory of executing program      *)
  469.     flags          * : LONGSET;       (* flags telling dos about process          *)
  470.     exitCode       * : e.PROC;        (* code to call on exit of program or NULL  *)
  471.     exitData       * : LONGINT;       (* Passed as an argument to pr_ExitCode.    *)
  472.     arguments      * : e.LSTRPTR;     (* Arguments passed to the process at start *)
  473.     localVars      * : e.MinList;     (* Local environment variables             *)
  474.     shellPrivate   * : LONGINT;       (* for the use of the current shell         *)
  475.     ces            * : FileHandlePtr; (* Error stream - if NULL, use pr_COS       *)
  476.   END;
  477.  
  478. CONST
  479.  
  480. (*
  481.  * Flags for Process.flags
  482.  *)
  483.   freeSegList     * = 0;
  484.   freeCurrDir     * = 1;
  485.   freeCLI         * = 2;
  486.   closeInput      * = 3;
  487.   closeOutput     * = 4;
  488.   freeArgs        * = 5;
  489.  
  490. TYPE
  491.  
  492. (* The long word address (BPTR) of this structure is returned by
  493.  * Open() and other routines that return a file.  You need only worry
  494.  * about this struct to do async io's via PutMsg() instead of
  495.  * standard file system calls *)
  496.  
  497.   FileHandle * = STRUCT
  498.     link * : e.MessagePtr;      (* EXEC message              *)
  499.     port * : e.MsgPortPtr;      (* Reply port for the packet *)
  500.     type * : ProcessId;         (* Port to do PutMsg() to
  501.                                  * Address is negative if a plain file *)
  502.     buf  * : LONGINT;
  503.     pos  * : LONGINT;
  504.     end  * : LONGINT;
  505.     func1* : LONGINT;
  506.     func2* : LONGINT;
  507.     func3* : LONGINT;
  508.     arg1 * : LONGINT;
  509.     arg2 * : LONGINT;
  510.   END;
  511.  
  512. (* This is the extension to EXEC Messages used by DOS *)
  513.  
  514.   DosPacket * = STRUCT
  515.     link * : e.MessagePtr;      (* EXEC message              *)
  516.     port * : e.MsgPortPtr;      (* Reply port for the packet *)
  517.                                 (* Must be filled in each send. *)
  518.     type * : LONGINT;           (* See ACTION_... below and                    (* action *)
  519.                                  * 'R' means Read, 'W' means Write to the
  520.                                  * file system *)
  521.     res1 * : LONGINT;           (* For file system calls this is the result    (* status *)
  522.                                  * that would have been returned by the
  523.                                  * function, e.g. Write ('W') returns actual
  524.                                  * length written *)
  525.     res2 * : LONGINT;           (* For file system calls this is what would    (* status2 *)
  526.                                  * have been returned by IoErr() *)
  527.     arg1 * : LONGINT;                                                          (* bufAddr *)
  528.     arg2 * : LONGINT;
  529.     arg3 * : LONGINT;
  530.     arg4 * : LONGINT;
  531.     arg5 * : LONGINT;
  532.     arg6 * : LONGINT;
  533.     arg7 * : LONGINT;
  534.   END;
  535.  
  536. (* A Packet does not require the Message to be before it in memory, but
  537.  * for convenience it is useful to associate the two.
  538.  * Also see the function init_std_pkt for initializing this structure *)
  539.  
  540.   StandardPacket * = STRUCT (msg * : e.Message)
  541.     pkt * : DosPacket;
  542.   END;
  543.  
  544. CONST
  545.  
  546. (* DosPacket.type *)
  547.   nil              * = 0;
  548.   startup          * = 0;
  549.   getBlock         * = 2;       (* OBSOLETE *)
  550.   setMap           * = 4;
  551.   die              * = 5;
  552.   event            * = 6;
  553.   currentVolume    * = 7;
  554.   locateObject     * = 8;
  555.   renameDisk       * = 9;
  556.   write            * = ORD('W');
  557.   read             * = ORD('R');
  558.   freeLock         * = 15;
  559.   deleteObject     * = 16;
  560.   renameObject     * = 17;
  561.   moreCache        * = 18;
  562.   copyDir          * = 19;
  563.   waitChar         * = 20;
  564.   setProtect       * = 21;
  565.   createDir        * = 22;
  566.   examineObject    * = 23;
  567.   examineNext      * = 24;
  568.   diskInfo         * = 25;
  569.   info             * = 26;
  570.   flush            * = 27;
  571.   setComment       * = 28;
  572.   parent           * = 29;
  573.   timer            * = 30;
  574.   inhibit          * = 31;
  575.   diskType         * = 32;
  576.   diskChange       * = 33;
  577.   setDate          * = 34;
  578.  
  579.   screenMode       * = 994;
  580.  
  581.   readReturn       * = 1001;
  582.   writeReturn      * = 1002;
  583.   seek             * = 1008;
  584.   findUpdate       * = 1004;
  585.   findInput        * = 1005;
  586.   findOutput       * = 1006;
  587.   actionEnd        * = 1007;
  588.   setFileSize      * = 1022;    (* fast file system only in 1.3 *)
  589.   writeprotect     * = 1023;    (* fast file system only in 1.3 *)
  590.  
  591. (* new 2.0 packets *)
  592.   sameLock         * = 40;
  593.   changeSignal     * = 995;
  594.   format           * = 1020;
  595.   makeLink         * = 1021;
  596.   (**)
  597.   (**)
  598.   readLink         * = 1024;
  599.   fhFromLock       * = 1026;
  600.   isFileSystem     * = 1027;
  601.   changeMode       * = 1028;
  602.   (**)
  603.   copyDirFH        * = 1030;
  604.   parentFH         * = 1031;
  605.   examineAll       * = 1033;
  606.   examineFH        * = 1034;
  607.  
  608.   lockRecord       * = 2008;
  609.   freeRecord       * = 2009;
  610.  
  611.   addNotify        * = 4097;
  612.   removeNotify     * = 4098;
  613.  
  614. (* Added in V39: *)
  615.   examineAllEnd    * = 1035;
  616.   setOwner         * = 1036;
  617.  
  618.  
  619. TYPE
  620.  
  621. (*
  622.  * A structure for holding error messages - stored as array with error == 0
  623.  * for the last entry.
  624.  *)
  625.  
  626.   ErrorString * = STRUCT
  627.     nums    * : e.APTR;
  628.     strings * : e.APTR;
  629.   END;
  630.  
  631. (* DOS library node structure.
  632.  * This is the data at positive offsets from the library node.
  633.  * Negative offsets from the node is the jump table to DOS functions
  634.  * node = (struct DosLibrary * ) OpenLibrary( "dos.library" .. )      *)
  635.  
  636.   DosLibrary * = STRUCT (lib * : e.Library)
  637.     root * : RootNodePtr;       (* Pointer to RootNode, described below *)
  638.     gv   * : e.APTR;            (* Pointer to BCPL global vector        *)
  639.     a2     : LONGINT;           (* Private register dump of DOS         *)
  640.     a5     : LONGINT;
  641.     a6     : LONGINT;
  642.     errors * : ErrorStringPtr; (* pointer to array of error msgs *)
  643.     timeReq   : t.TimeRequestPtr; (* private pointer to timer request *)
  644.     utilityBase   : e.LibraryPtr; (* private ptr to utility library *)
  645.   END;
  646.  
  647. (*                             *)
  648.  
  649.   TaskArray * = STRUCT
  650.     maxCLI * : LONGINT;
  651.     cli    * : ARRAY 10000000H OF ProcessId;
  652.   END;
  653.  
  654.   RootNode * = STRUCT
  655.     taskArray * : TaskArrayPtr;      (* [0] is max number of CLI's
  656.                                       * [1] is APTR to process id of CLI 1
  657.                                       * [n] is APTR to process id of CLI n       *)
  658.     consoleSegment * : e.BPTR;       (* SegList for the CLI                      *)
  659.     time * : Date;                   (* Current time                             *)
  660.     restartSeg * : e.BPTR;           (* SegList for the disk validator process   *)
  661.     info * : DosInfoPtr;             (* Pointer to the Info structure            *)
  662.     fileHandlerSegment * : e.BPTR;   (* segment for a file handler               *)
  663.     cliList * : e.MinList;           (* new list of all CLI processes            *)
  664.                                      (* the first cpl_Array is also rn_TaskArray *)
  665.     bootProc  -: ProcessId;          (* private ptr to msgport of boot fs        *)
  666.     shellSegment * : e.BPTR;         (* seglist for Shell (for NewShell)         *)
  667.     flags * : LONGSET;               (* dos flags *)
  668.   END;
  669.  
  670. CONST
  671. (* RootNode.flags *)
  672.   wildStar * = 24;
  673.   private1 * = 1;
  674.  
  675. TYPE
  676.  
  677. (* ONLY to be allocated by DOS! *)
  678.   CliProcList * = STRUCT (node * : e.MinNode)
  679.         first * : LONGINT;      (* number of first entry in array *)
  680.         array * : UNTRACED POINTER TO ARRAY 1FFFFFFFH OF ProcessId;
  681.                              (* [0] is max number of CLI's in this entry (n)
  682.                               * [1] is CPTR to process id of CLI cpl_First
  683.                               * [n] is CPTR to process id of CLI cpl_First+n-1
  684.                               *)
  685.   END;
  686.  
  687.   DosInfo * = STRUCT
  688.     mcName * : BSTR;           (* Network name of this machine; currently 0 *)
  689.     devInfo * : DevInfoPtr;    (* Device List                               *)
  690.     devices * : e.BPTR;        (* Currently zero                            *)
  691.     handlers * : e.BPTR;       (* Currently zero                            *)
  692.     nethand  * : ProcessId;          (* Network handler processid; currently zero *)
  693.     devLock * : e.SignalSemaphore;   (* do NOT access directly! *)
  694.     entryLock * : e.SignalSemaphore; (* do NOT access directly! *)
  695.     deleteLock * : e.SignalSemaphore;(* do NOT access directly! *)
  696.   END;
  697.  
  698.  
  699. (* structure for the Dos resident list.  Do NOT allocate these, use       *)
  700. (* AddSegment(), and heed the warnings in the autodocs!                   *)
  701.  
  702.   Segment * = STRUCT
  703.     next * : e.BPTR;
  704.     uc * : LONGINT;
  705.     seg * : e.BPTR;
  706.     name * : ARRAY 4 OF CHAR;     (* actually the first 4 chars of BSTR name *)
  707.   END;
  708.  
  709. CONST
  710.  
  711.   cmdSystem   * = -1;
  712.   cmdInternal * = -2;
  713.   cmdDisabled * = -999;
  714.  
  715.  
  716. TYPE
  717.  
  718.   PathLock    * = STRUCT
  719.                     next * : PathLockPtr;
  720.                     lock * : FileLockPtr;
  721.                   END;
  722.  
  723. (* DOS Processes started from the CLI via RUN or NEWCLI have this additional
  724.  * set to data associated with them *)
  725.  
  726.   CommandLineInterface * = STRUCT
  727.     result2        * : LONGINT;       (* Value of IoErr from last command        *)
  728.     setName        * : BSTR;          (* Name of current directory               *)
  729.     commandDir     * : PathLockPtr;   (* Head of the path locklist               *)
  730.     returnCode     * : LONGINT;       (* Return code from last command           *)
  731.     commandName    * : BSTR;          (* Name of current command                 *)
  732.     failLevel      * : LONGINT;       (* Fail level (set by FAILAT)              *)
  733.     prompt         * : BSTR;          (* Current prompt (set by PROMPT)          *)
  734.     standardInput  * : FileHandlePtr; (* Default (terminal) CLI input            *)
  735.     currentInput   * : FileHandlePtr; (* Current CLI input                       *)
  736.     commandFile    * : BSTR;          (* Name of EXECUTE command file            *)
  737.     interactive    * : LONGINT;       (* Boolean; True if prompts required       *)
  738.     background     * : LONGINT;       (* Boolean; True if CLI created by RUN     *)
  739.     currentOutput  * : FileHandlePtr; (* Current CLI output                      *)
  740.     defaultStack   * : LONGINT;       (* Stack size to be obtained in long words *)
  741.     standardOutput * : FileHandlePtr; (* Default (terminal) CLI output           *)
  742.     module         * : e.BPTR;        (* SegList of currently loaded command     *)
  743.  
  744.  
  745.   END;
  746.  
  747. (* This structure can take on different values depending on whether it is
  748.  * a device, an assigned directory, or a volume.  Below is the structure
  749.  * reflecting volumes only.  Following that is the structure representing
  750.  * only devices. Following that is the unioned structure representing all
  751.  * the values
  752.  *)
  753.  
  754.   DosListNode * = STRUCT END; (* Dummy to make the following STRUCTs compatible *)
  755.  
  756. (* structure representing a volume *)
  757.  
  758.   DeviceList * = STRUCT (dummy: DosListNode)
  759.     next       * : DeviceListPtr;  (* bptr to next device list *)
  760.     type       * : LONGINT;        (* see DLT below *)
  761.     task       * : ProcessId;      (* ptr to handler task *)
  762.     lock       * : FileLockPtr;    (* not for volumes *)
  763.     volumeDate * : Date;           (* creation date *)
  764.     lockList   * : FileLockPtr;    (* outstanding locks *)
  765.     diskType   * : LONGINT;        (* 'DOS', etc *)
  766.     unused     * : LONGINT;
  767.     name       * : BSTR;           (* bptr to bcpl name *)
  768.   END;
  769.  
  770. (* device structure (same as the DeviceNode structure in filehandler.h) *)
  771.  
  772.   DevInfo * = STRUCT (dummy: DosListNode)
  773.     next      * : DevInfoPtr;
  774.     type      * : LONGINT;
  775.     task      * : ProcessId;
  776.     lock      * : FileLockPtr;
  777.     handler   * : BSTR;
  778.     stackSize * : LONGINT;
  779.     priority  * : LONGINT;
  780.     startup   * : FileSysStartupMsgPtr;
  781.     segList   * : e.BPTR;
  782.     globVec   * : e.BPTR;
  783.     name      * : BSTR;
  784.   END;
  785.  
  786. (* combined structure for devices, assigned directories, volumes *)
  787.  
  788.   DosList * = STRUCT (dummy: DosListNode)
  789.     next      * : DevInfoPtr;
  790.     type      * : LONGINT;
  791.     task      * : ProcessId;
  792.     lock      * : FileLockPtr;
  793.  
  794.     assignName* : e.LSTRPTR;      (* name for non-or-late-binding assign *)
  795.     list      * : AssignListPtr;  (* for multi-directory assigns (regular) *)
  796.     unused    * : ARRAY 4 OF LONGINT;
  797.     name      * : BSTR;
  798.   END;
  799.  
  800. (* structure used for multi-directory assigns. AllocVec()ed. *)
  801.  
  802.   AssignList * = STRUCT
  803.     next * : AssignListPtr;
  804.     lock * : FileLockPtr;
  805.   END;
  806.  
  807. CONST
  808.  
  809. (* definitions for DosList.type *)
  810.   device      * = 0;
  811.   directory   * = 1;       (* assign *)
  812.   volume      * = 2;
  813.   late        * = 3;       (* late-binding assign *)
  814.   nonBinding  * = 4;       (* non-binding assign *)
  815.   private     * = -1;      (* for internal use only *)
  816.  
  817. TYPE
  818.  
  819. (* structure return by GetDeviceProc() *)
  820.   DevProc * = STRUCT
  821.     port * : e.MsgPortPtr;
  822.     lock * : FileLockPtr;
  823.     flags * : LONGSET;
  824.     devNode : DosListNodePtr;    (* DON'T TOUCH OR USE! *)
  825.   END;
  826.  
  827. CONST
  828.  
  829. (* definitions for DevProc.flags *)
  830.   unLock  * = 0;
  831.   assign  * = 1;
  832.  
  833. (* Flags to be passed to LockDosList(), etc *)
  834.   devices   * = 2;
  835.   volumes   * = 3;
  836.   assigns   * = 4;
  837.   entry     * = 5;
  838.   ldDelete  * = 6;
  839.  
  840. (* you MUST specify one of read or write *)
  841.   dosListRead * = 0;
  842.   dosListWrite * = 1;
  843.  
  844. (* actually all but entry (which is used for internal locking) *)
  845.   all * = LONGSET{devices,volumes,assigns};
  846.  
  847. TYPE
  848.  
  849. (* a lock structure, as returned by Lock() or DupLock() *)
  850.   FileLock * = STRUCT
  851.     link   * : FileLockPtr;   (* bcpl pointer to next lock *)
  852.     key    * : LONGINT;       (* disk block number *)
  853.     access * : LONGINT;       (* exclusive or shared *)
  854.     task   * : ProcessId;     (* handler task's port *)
  855.     volume * : DeviceListPtr; (* bptr to DLT_VOLUME DosList entry *)
  856.   END;
  857.  
  858. CONST
  859.  
  860. (* error report types for ErrorReport() *)
  861.   reportStream * = 0;      (* a stream *)
  862.   reportTask   * = 1;      (* a process - unused *)
  863.   reportLock   * = 2;      (* a lock *)
  864.   reportVolume * = 3;      (* a volume node *)
  865.   reportInsert * = 4;      (* please insert volume *)
  866.  
  867. (* Special error codes for ErrorReport() *)
  868.   diskError  * = 296;     (* Read/write error *)
  869.   abortBusy  * = 288;     (* You MUST replace... *)
  870.  
  871. (* types for initial packets to shells from run/newcli/execute/system. *)
  872. (* For shell-writers only *)
  873.   runExecute         * = -1;
  874.   runSystem          * = -2;
  875.   runSystemAsynch    * = -3;
  876.  
  877. (* Types for FileInfoBlock.dirEntryType. NOTE that both USERDIR and ROOT are  *)
  878. (* directories, and that directory/file checks should use <0 and >=0.    *)
  879. (* This is not necessarily exhaustive!  Some handlers may use other      *)
  880. (* values as needed, though <0 and >=0 should remain as supported as     *)
  881. (* possible.                                                             *)
  882.   root       * = 1;
  883.   userDir    * = 2;
  884.   softLink   * = 3;       (* looks like dir, but may point to a file! *)
  885.   linkDir    * = 4;       (* hard link to dir *)
  886.   file       * = -3;      (* must be negative for FIB! *)
  887.   linkFile   * = -4;      (* hard link to file *)
  888.  
  889.  
  890. (* hunk types *)
  891.   hunkUnit       * = 999;
  892.   hunkName       * = 1000;
  893.   hunkCode       * = 1001;
  894.   hunkData       * = 1002;
  895.   hunkBSS        * = 1003;
  896.   hunkReloc32    * = 1004;
  897.   hunkAbsReloc32 * = hunkReloc32;
  898.   hunkReloc16    * = 1005;
  899.   hunkRelReloc16 * = hunkReloc16;
  900.   hunkReloc8     * = 1006;
  901.   hunkRelReloc8  * = hunkReloc8;
  902.   hunkExt        * = 1007;
  903.   hunkSymbol     * = 1008;
  904.   hunkDebug      * = 1009;
  905.   hunkEnd        * = 1010;
  906.   hunkHeader     * = 1011;
  907.  
  908.   hunkOverlay    * = 1013;
  909.   hunkBreak      * = 1014;
  910.  
  911.   hunkDRel32     * = 1015;
  912.   hunkDRel16     * = 1016;
  913.   hunkDRel8      * = 1017;
  914.  
  915.   hunkLib        * = 1018;
  916.   hunkIndex      * = 1019;
  917.  
  918. (*
  919.  * Note: V37 LoadSeg uses 1015 (HUNK_DREL32) by mistake.  This will continue
  920.  * to be supported in future versions, since HUNK_DREL32 is illegal in load files
  921.  * anyways.  Future versions will support both 1015 and 1020, though anything
  922.  * that should be usable under V37 should use 1015.
  923.  *)
  924.   hunkReloc32Short * = 1020;
  925.  
  926. (* see ext_xxx below.  New for V39 (note that LoadSeg only handles RELRELOC32).*)
  927.   hunkRelReloc32   * = 1021;
  928.   hunkAbsReloc16   * = 1022;
  929.  
  930. (*
  931.  * Any hunks that have the HUNKB_ADVISORY bit set will be ignored if they
  932.  * aren't understood.  When ignored, they're treated like HUNK_DEBUG hunks.
  933.  * NOTE: this handling of HUNKB_ADVISORY started as of V39 dos.library!  If
  934.  * lading such executables is attempted under <V39 dos, it will fail with a
  935.  * bad hunk type.
  936.  *)
  937.   hunkBAdvisory    * = 29;
  938.   hunkBChip        * = 30;
  939.   hunkBFast        * = 31;
  940.  
  941.  
  942. (* hunk_ext sub-types *)
  943.   extSymb        * = 0;       (* symbol table *)
  944.   extDef         * = 1;       (* relocatable definition *)
  945.   extAbs         * = 2;       (* Absolute definition *)
  946.   extRes         * = 3;       (* no longer supported *)
  947.   extRef32       * = 129;     (* 32 bit reference to symbol *)
  948.   extAbsRef32    * = extRef32;
  949.   extCommon      * = 130;     (* 32 bit reference to COMMON block *)
  950.   extAbsCommon   * = extCommon;
  951.   extRef16       * = 131;     (* 16 bit reference to symbol *)
  952.   extRelRef16    * = extRef16;
  953.   extRef8        * = 132;     (*  8 bit reference to symbol *)
  954.   extRelRef8     * = extRef8;
  955.   extDExt32      * = 133;     (* 32 bit data releative reference *)
  956.   extDExt16      * = 134;     (* 16 bit data releative reference *)
  957.   extDExt8       * = 135;     (*  8 bit data releative reference *)
  958.  
  959. (* These are to support some of the '020 and up modes that are rarely used *)
  960.   extRelRef32    * = 136;     (* 32 bit PC-relative reference to symbol *)
  961.   extRelCommon   * = 137;     (* 32 bit PC-relative reference to COMMON block *)
  962.  
  963. (* for completeness... All 680x0's support this *)
  964.   extAbsRef16    * = 138;     (* 16 bit absolute reference to symbol *)
  965.  
  966. (* this only exists on '020's and above, in the (d8,An,Xn) address mode *)
  967.   extAbsRef8     * = 139;     (* 8 bit absolute reference to symbol *)
  968.  
  969.  
  970. (*****************************************************************************)
  971. (* definitions for the System() call *)
  972.  
  973.   sysDummy       * = u.user + 32;
  974.   sysInput       * = sysDummy + 1;      (* specifies the input filehandle  *)
  975.   sysOutput      * = sysDummy + 2;      (* specifies the output filehandle *)
  976.   sysAsynch      * = sysDummy + 3;      (* run asynch, close input/output on exit(!) *)
  977.   sysUserShell   * = sysDummy + 4;      (* send to user shell instead of boot shell *)
  978.   sysCustomShell * = sysDummy + 5;      (* send to a specific shell (data is name) *)
  979.  
  980.  
  981. (*****************************************************************************)
  982. (* definitions for the CreateNewProc() call *)
  983. (* you MUST specify one of NP_Seglist or NP_Entry.  All else is optional. *)
  984.  
  985.   npDummy        * = u.user + 1000;
  986.   npSeglist      * = npDummy + 1; (* seglist of code to run for the process  *)
  987.   npFreeSeglist  * = npDummy + 2; (* free seglist on exit - only valid for   *)
  988.                                   (* for NP_Seglist.  Default is TRUE.       *)
  989.   npEntry        * = npDummy + 3; (* entry point to run - mutually exclusive *)
  990.                                   (* with NP_Seglist! *)
  991.   npInput        * = npDummy + 4; (* filehandle - default is Open("NIL:"...) *)
  992.   npOutput       * = npDummy + 5; (* filehandle - default is Open("NIL:"...) *)
  993.   npCloseInput   * = npDummy + 6; (* close input filehandle on exit          *)
  994.                                   (* default TRUE                            *)
  995.   npCloseOutput  * = npDummy + 7; (* close output filehandle on exit         *)
  996.                                   (* default TRUE                            *)
  997.   npError        * = npDummy + 8; (* filehandle - default is Open("NIL:"...) *)
  998.   npCloseError   * = npDummy + 9; (* close error filehandle on exit          *)
  999.                                   (* default TRUE                            *)
  1000.   npCurrentDir   * = npDummy + 10; (* lock - default is parent's current dir  *)
  1001.   npStackSize    * = npDummy + 11; (* stacksize for process - default 4000    *)
  1002.   npName         * = npDummy + 12; (* name for process - default "New Process"*)
  1003.   npPriority     * = npDummy + 13; (* priority - default same as parent       *)
  1004.   npConsoleTask  * = npDummy + 14; (* consoletask - default same as parent    *)
  1005.   npWindowPtr    * = npDummy + 15; (* window ptr - default is same as parent  *)
  1006.   npHomeDir      * = npDummy + 16; (* home directory - default curr home dir  *)
  1007.   npCopyVars     * = npDummy + 17; (* boolean to copy local vars-default TRUE *)
  1008.   npCli          * = npDummy + 18; (* create cli structure - default FALSE    *)
  1009.   npPath         * = npDummy + 19; (* path - default is copy of parents path  *)
  1010.                                    (* only valid if a cli process!    *)
  1011.   npCommandName  * = npDummy + 20; (* commandname - valid only for CLI        *)
  1012.   npArguments    * = npDummy + 21; (* cstring of arguments - passed with str  *)
  1013.                                    (* in a0, length in d0.  (copied and freed *)
  1014.                                    (* on exit.  Default is empty string.      *)
  1015.                                    (* NOTE: not operational until 2.04 - see  *)
  1016.                                    (* BIX/TechNotes for more info/workarounds *)
  1017.                                    (* NOTE: in 2.0, it DIDN'T pass "" - the   *)
  1018.                                    (* registers were random.                  *)
  1019. (* FIX! should this be only for cli's? *)
  1020.   npNotifyOnDeath * = npDummy + 22; (* notify parent on death - default FALSE  *)
  1021.                                     (* Not functional yet. *)
  1022.   npSynchronous  * = npDummy + 23; (* don't return until process finishes -   *)
  1023.                                    (* default FALSE.                          *)
  1024.                                    (* Not functional yet. *)
  1025.   npExitCode     * = npDummy + 24; (* code to be called on process exit       *)
  1026.   npExitData     * = npDummy + 25; (* optional argument for NP_EndCode rtn -  *)
  1027.                                    (* default NULL                            *)
  1028.  
  1029.  
  1030. (*****************************************************************************)
  1031. (* tags for AllocDosObject *)
  1032.  
  1033.   adoDummy       * = u.user + 2000;
  1034.   adoFHMode      * = adoDummy + 1;
  1035.                                 (* for type DOS_FILEHANDLE only            *)
  1036.                                 (* sets up FH for mode specified.
  1037.                                    This can make a big difference for buffered
  1038.                                    files.                                  *)
  1039.         (* The following are for DOS_CLI *)
  1040.         (* If you do not specify these, dos will use it's preferred values *)
  1041.         (* which may change from release to release.  The BPTRs to these   *)
  1042.         (* will be set up correctly for you.  Everything will be zero,     *)
  1043.         (* except cli_FailLevel (10) and cli_Background (DOSTRUE).         *)
  1044.         (* NOTE: you may also use these 4 tags with CreateNewProc.         *)
  1045.  
  1046.   adoDirLen      * = adoDummy + 2; (* size in bytes for current dir buffer    *)
  1047.   adoCommNameLen * = adoDummy + 3; (* size in bytes for command name buffer   *)
  1048.   adoCommFileLen * = adoDummy + 4; (* size in bytes for command file buffer   *)
  1049.   adoPromptLen   * = adoDummy + 5; (* size in bytes for the prompt buffer     *)
  1050.  
  1051. (*****************************************************************************)
  1052. (* tags for NewLoadSeg *)
  1053. (* no tags are defined yet for NewLoadSeg *)
  1054.  
  1055. (* NOTE: V37 dos.library, when doing ExAll() emulation, and V37 filesystems  *)
  1056. (* will return an error if passed ED_OWNER.  If you get ERROR_BAD_NUMBER,    *)
  1057. (* retry with ED_COMMENT to get everything but owner info.  All filesystems  *)
  1058. (* supporting ExAll() must support through ED_COMMENT, and must check Type   *)
  1059. (* and return ERROR_BAD_NUMBER if they don't support the type.                     *)
  1060.  
  1061. (* values that can be passed for what data you want from ExAll() *)
  1062. (* each higher value includes those below it (numerically)       *)
  1063. (* you MUST chose one of these values *)
  1064.   name        * = 1;
  1065.   type        * = 2;
  1066.   size        * = 3;
  1067.   protection  * = 4;
  1068.   date        * = 5;
  1069.   comment     * = 6;
  1070.   owner       * = 7;
  1071.  
  1072. TYPE
  1073.  
  1074. (*
  1075.  *   Structure in which exall results are returned in.  Note that only the
  1076.  *   fields asked for will exist!
  1077.  *)
  1078.  
  1079.   ExAllData * = STRUCT
  1080.         next * : ExAllDataPtr;
  1081.         name * : e.LSTRPTR;
  1082.         type * : LONGINT;
  1083.         size * : LONGINT;
  1084.         prot * : LONGSET;
  1085.         days * : LONGINT;
  1086.         mins * : LONGINT;
  1087.         ticks    * : LONGINT;
  1088.         comment  * : e.LSTRPTR;  (* strings will be after last used field *)
  1089.         ownerUID * : INTEGER;    (* new for V39 *)
  1090.         ownerGID * : INTEGER;
  1091.   END;
  1092.  
  1093. (*
  1094.  *   Control structure passed to ExAll.  Unused fields MUST be initialized to
  1095.  *   0, expecially eac_LastKey.
  1096.  *
  1097.  *   eac_MatchFunc is a hook (see utility.library documentation for usage)
  1098.  *   It should return true if the entry is to returned, false if it is to be
  1099.  *   ignored.
  1100.  *
  1101.  *   This structure MUST be allocated by AllocDosObject()!
  1102.  *)
  1103.  
  1104.   ExAllControl * = STRUCT
  1105.     entries     * : LONGINT;    (* number of entries returned in buffer      *)
  1106.     lastKey     * : LONGINT;    (* Don't touch inbetween linked ExAll calls! *)
  1107.     matchString * : e.LSTRPTR;  (* wildcard string for pattern match or NULL *)
  1108.     matchFunc   * : u.HookPtr;  (* optional private wildcard function        *)
  1109.   END;
  1110.  
  1111.  
  1112. (* The disk "environment" is a longword array that describes the
  1113.  * disk geometry.  It is variable sized, with the length at the beginning.
  1114.  * Here are the constants for a standard geometry.
  1115.  *)
  1116.  
  1117.   DosEnvec * = STRUCT
  1118.     tableSize      * : LONGINT; (* size of Environment vector *)
  1119.     sizeBlock      * : LONGINT; (* in longwords: standard value is 128 *)
  1120.     secOrg         * : LONGINT; (* not used; must be 0 *)
  1121.     surfaces       * : LONGINT; (* # of heads (surfaces). drive specific *)
  1122.     sectorPerBlock * : LONGINT; (* not used; must be 1 *)
  1123.     blocksPerTrack * : LONGINT; (* blocks per track. drive specific *)
  1124.     reserved       * : LONGINT; (* DOS reserved blocks at start of partition. *)
  1125.     preAlloc       * : LONGINT; (* DOS reserved blocks at end of partition *)
  1126.     interleave     * : LONGINT; (* usually 0 *)
  1127.     lowCyl         * : LONGINT; (* starting cylinder. typically 0 *)
  1128.     highCyl        * : LONGINT; (* max cylinder. drive specific *)
  1129.     numBuffers     * : LONGINT; (* Initial # DOS of buffers.  *)
  1130.     bufMemType     * : LONGINT; (* type of mem to allocate for buffers *)
  1131.     maxTransfer    * : LONGINT; (* Max number of bytes to transfer at a time *)
  1132.     mask           * : LONGSET; (* Address Mask to block out certain memory *)
  1133.     bootPri        * : LONGINT; (* Boot priority for autoboot *)
  1134.     dosType        * : LONGINT; (* ASCII (HEX) string showing filesystem type;
  1135.                                  * 0X444F5300 is old filesystem,
  1136.                                  * 0X444F5301 is fast file system *)
  1137.     baud           * : LONGINT; (* Baud rate for serial handler *)
  1138.     control        * : LONGINT; (* Control word for handler/filesystem *)
  1139.     bootBlocks     * : LONGINT; (* Number of blocks containing boot code *)
  1140.   END;
  1141.  
  1142. CONST
  1143.  
  1144. (* these are the offsets into the array *)
  1145. (* DE_TABLESIZE is set to the number of longwords in the table minus 1 *)
  1146.  
  1147.   tableSize    * = 0;       (* minimum value is 11 (includes NumBuffers) *)
  1148.   sizeBlock    * = 1;       (* in longwords: standard value is 128 *)
  1149.   secOrg       * = 2;       (* not used; must be 0 *)
  1150.   numHeads     * = 3;       (* # of heads (surfaces). drive specific *)
  1151.   secsPerBlk   * = 4;       (* not used; must be 1 *)
  1152.   blksPerTrack * = 5;       (* blocks per track. drive specific *)
  1153.   reservedBlks * = 6;       (* unavailable blocks at start.  usually 2 *)
  1154.   preFac       * = 7;       (* not used; must be 0 *)
  1155.   interLeave   * = 8;       (* usually 0 *)
  1156.   lowCyl       * = 9;       (* starting cylinder. typically 0 *)
  1157.   upperCyl     * = 10;      (* max cylinder.  drive specific *)
  1158.   numBuffers   * = 11;      (* starting # of buffers.  typically 5 *)
  1159.   memBufType   * = 12;      (* type of mem to allocate for buffers. *)
  1160.   bufMemType   * = 12;      (* same as above, better name
  1161.                              * 1 is public, 3 is chip, 5 is fast *)
  1162.   maxTransfer  * = 13;      (* Max number bytes to transfer at a time *)
  1163.   mask         * = 14;      (* Address Mask to block out certain memory *)
  1164.   bootPri      * = 15;      (* Boot priority for autoboot *)
  1165.   dosType      * = 16;      (* ASCII (HEX) string showing filesystem type;
  1166.                              * 0X444F5300 is old filesystem,
  1167.                              * 0X444F5301 is fast file system *)
  1168.   baud         * = 17;      (* Baud rate for serial handler *)
  1169.   control      * = 18;      (* Control word for handler/filesystem *)
  1170.   bootBlocks   * = 19;      (* Number of blocks containing boot code *)
  1171.  
  1172. TYPE
  1173.  
  1174. (* The file system startup message is linked into a device node's startup
  1175. ** field.  It contains a pointer to the above environment, plus the
  1176. ** information needed to do an exec OpenDevice().
  1177. *)
  1178.   FileSysStartupMsg * = STRUCT
  1179.     unit    * : LONGINT;     (* exec unit number for this device *)
  1180.     device  * : BSTR;        (* null terminated bstring to the device name *)
  1181.     environ * : DosEnvecPtr; (* ptr to environment table (see above) *)
  1182.     flags   * : LONGSET;     (* flags for OpenDevice() *)
  1183.   END;
  1184.  
  1185.  
  1186. (* The include file "libraries/dosextens.h" has a DeviceList structure.
  1187.  * The "device list" can have one of three different things linked onto
  1188.  * it.  Dosextens defines the structure for a volume.  DLT_DIRECTORY
  1189.  * is for an assigned directory.  The following structure is for
  1190.  * a dos "device" (DLT_DEVICE).
  1191. *)
  1192.  
  1193.   DeviceNode * = STRUCT
  1194.     next      * : DeviceNodePtr;        (* singly linked list *)
  1195.     type      * : LONGINT;              (* always 0 for dos "devices" *)
  1196.     task      * : ProcessId;            (* standard dos "task" field.  If this is
  1197.                                          * null when the node is accesses, a task
  1198.                                          * will be started up *)
  1199.     lock      * : FileLockPtr;          (* not used for devices -- leave null *)
  1200.     handler   * : BSTR;                 (* filename to loadseg (if seglist is null) *)
  1201.     stackSize * : LONGINT;              (* stacksize to use when starting task *)
  1202.     priority  * : LONGINT;              (* task priority when starting task *)
  1203.     startup   * : FileSysStartupMsgPtr; (* startup msg: FileSysStartupMsg for disks *)
  1204.     segList   * : e.BPTR;               (* code to run to start new task (if necessary).
  1205.                                          * if null then dn_Handler will be loaded. *)
  1206.     globalVec * : e.BPTR;               (* BCPL global vector to use when starting
  1207.                                          * a task.  -1 means that dn_SegList is not
  1208.                                          * for a bcpl program, so the dos won't
  1209.                                          * try and construct one.  0 tell the
  1210.                                          * dos that you obey BCPL linkage rules,
  1211.                                          * and that it should construct a global
  1212.                                          * vector for you.
  1213.                                          *)
  1214.     name      * : BSTR;                 (* the node name, e.g. '\3','D','F','3' *)
  1215.   END;
  1216.  
  1217. CONST
  1218.  
  1219. (* use of Class and code is discouraged for the time being - we might want to
  1220.    change things *)
  1221. (* --- NotifyMessage Class ------------------------------------------------ *)
  1222.   class  * = 40000000H;
  1223.  
  1224. (* --- NotifyMessage Codes ------------------------------------------------ *)
  1225.   code   * = 1234H;
  1226.  
  1227. TYPE
  1228.  
  1229. (* Sent to the application if SEND_MESSAGE is specified.                    *)
  1230.  
  1231.   NotifyMessage * = STRUCT (execMessage * : e.Message)
  1232.     class       * : LONGINT;
  1233.     code        * : INTEGER;
  1234.     nReq        * : NotifyRequestPtr;      (* don't modify the request! *)
  1235.     doNotTouch    : LONGINT;               (* like it says!  For use by handlers *)
  1236.     doNotTouch2   : LONGINT;               (* dito *)
  1237.   END;
  1238.  
  1239. (* Do not modify or reuse the notifyrequest while active.                   *)
  1240. (* note: the first LONG of nr_Data has the length transfered                *)
  1241.  
  1242.   NotifyRequest * = STRUCT
  1243.     name * : e.LSTRPTR;
  1244.     fullName * : e.LSTRPTR;          (* set by dos - don't touch *)
  1245.     userData * : LONGINT;            (* for applications use *)
  1246.     flags * : LONGSET;
  1247.  
  1248.     task * : e.TaskPtr;              (* could also be: port * : e.MsgPortPtr *)
  1249.     signalNum * : SHORTINT;
  1250.     pad1,pad2,pad3: SHORTINT;
  1251.  
  1252.     reserved * : ARRAY 4 OF LONGINT; (* leave 0 for now *)
  1253.  
  1254.     (* internal use by handlers *)
  1255.     msgCount * : LONGINT;            (* # of outstanding msgs *)
  1256.     handler  * : e.MsgPortPtr;       (* handler sent to (for EndNotify) *)
  1257.   END;
  1258.  
  1259. CONST
  1260.  
  1261. (* --- NotifyRequest.flags ------------------------------------------------ *)
  1262.  
  1263.  
  1264.   sendMessage     * = 0;
  1265.   sendSignal      * = 1;
  1266.   waitReply       * = 3;
  1267.   notifyInitial   * = 4;
  1268.  
  1269. (* do NOT set or remove MAGIC!  Only for use by handlers! *)
  1270.   magic           * = 31;
  1271.  
  1272. (* Flags reserved for private use by the handler: *)
  1273.   handlerFlags    * = LONGSET{16..31};
  1274.  
  1275. TYPE
  1276.  
  1277. (**********************************************************************
  1278.  *
  1279.  * The CSource data structure defines the input source for "ReadItem()"
  1280.  * as well as the ReadArgs call.  It is a publicly defined structure
  1281.  * which may be used by applications which use code that follows the
  1282.  * conventions defined for access.
  1283.  *
  1284.  * When passed to the dos.library functions, the value passed as
  1285.  * struct *CSource is defined as follows:
  1286.  *      if ( CSource == 0)      Use buffered IO "ReadChar()" as data source
  1287.  *      else                    Use CSource for input character stream
  1288.  *
  1289.  * The following two pseudo-code routines define how the CSource structure
  1290.  * is used:
  1291.  *
  1292.  * long CS_ReadChar( struct CSource *CSource )
  1293.  * {
  1294.  *      if ( CSource == 0 )     return ReadChar();
  1295.  *      if ( CSource->CurChr >= CSource->Length )       return ENDSTREAMCHAR;
  1296.  *      return CSource->Buffer[ CSource->CurChr++ ];
  1297.  * }
  1298.  *
  1299.  * BOOL CS_UnReadChar( struct CSource *CSource )
  1300.  * {
  1301.  *      if ( CSource == 0 )     return UnReadChar();
  1302.  *      if ( CSource->CurChr <= 0 )     return FALSE;
  1303.  *      CSource->CurChr--;
  1304.  *      return TRUE;
  1305.  * }
  1306.  *
  1307.  * To initialize a struct CSource, you set CSource->CS_Buffer to
  1308.  * a string which is used as the data source, and set CS_Length to
  1309.  * the number of characters in the string.  Normally CS_CurChr should
  1310.  * be initialized to ZERO, or left as it was from prior use as
  1311.  * a CSource.
  1312.  *
  1313.  **********************************************************************)
  1314.  
  1315.   CSource * = STRUCT
  1316.     buffer * : e.LSTRPTR;
  1317.     length * : LONGINT;
  1318.     curChr * : LONGINT;
  1319.   END;
  1320.  
  1321. (**********************************************************************
  1322.  *
  1323.  * The RDArgs data structure is the input parameter passed to the DOS
  1324.  * ReadArgs() function call.
  1325.  *
  1326.  * The RDA_Source structure is a CSource as defined above;
  1327.  * if RDA_Source.CS_Buffer is non-null, RDA_Source is used as the input
  1328.  * character stream to parse, else the input comes from the buffered STDIN
  1329.  * calls ReadChar/UnReadChar.
  1330.  *
  1331.  * RDA_DAList is a private address which is used internally to track
  1332.  * allocations which are freed by FreeArgs().  This MUST be initialized
  1333.  * to NULL prior to the first call to ReadArgs().
  1334.  *
  1335.  * The RDA_Buffer and RDA_BufSiz fields allow the application to supply
  1336.  * a fixed-size buffer in which to store the parsed data.  This allows
  1337.  * the application to pre-allocate a buffer rather than requiring buffer
  1338.  * space to be allocated.  If either RDA_Buffer or RDA_BufSiz is NULL,
  1339.  * the application has not supplied a buffer.
  1340.  *
  1341.  * RDA_ExtHelp is a text string which will be displayed instead of the
  1342.  * template string, if the user is prompted for input.
  1343.  *
  1344.  * RDA_Flags bits control how ReadArgs() works.  The flag bits are
  1345.  * defined below.  Defaults are initialized to ZERO.
  1346.  *
  1347.  **********************************************************************)
  1348.  
  1349.   RDArgs * = STRUCT
  1350.     source  * : CSource;       (* Select input source *)
  1351.     daList  * : LONGINT;       (* PRIVATE. must be initiaized to 0 *)
  1352.     buffer  * : e.LSTRPTR;     (* Optional string parsing space. *)
  1353.     bufSiz  * : LONGINT;       (* Size of RDA_Buffer (0..n) *)
  1354.     extHelp * : e.LSTRPTR;     (* Optional extended help *)
  1355.     flags   * : LONGSET;       (* Flags for any required control *)
  1356.   END;
  1357.  
  1358. CONST
  1359.  
  1360. (* RDArgs.flags *)
  1361.   stdIn    * = 0;       (* Use "STDIN" rather than "COMMAND LINE" *)
  1362.   noAlloc  * = 1;       (* If set, do not allocate extra string space.*)
  1363.   noPrompt * = 2;       (* Disable reprompting for string input. *)
  1364.  
  1365. (**********************************************************************
  1366.  * Maximum number of template keywords which can be in a template passed
  1367.  * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
  1368.  **********************************************************************)
  1369.   maxTemplateItems * = 100;
  1370.  
  1371. (**********************************************************************
  1372.  * Maximum number of MULTIARG items returned by ReadArgs(), before
  1373.  * an ERROR_LINE_TOO_LONG.  These two limitations are due to stack
  1374.  * usage.  Applications should allow "a lot" of stack to use ReadArgs().
  1375.  **********************************************************************)
  1376.   maxMultiArgs * = 128;
  1377.  
  1378. TYPE
  1379. (*
  1380.  * use an extension of this and pass it to ReadArgs()
  1381.  * use one entry (see definitions below) for every template keyword
  1382.  * according to it's type.
  1383.  *
  1384.  * NOTE: This has been introduced to improof type safety since somebody
  1385.  *       tried to pass a POINTER TO ARRAY OF CHAR, what totaly confused the
  1386.  *       garbage collector.
  1387.  *)
  1388.  
  1389.   ArgsStruct * = STRUCT END;
  1390.  
  1391.   (* these are UNTRACED 'cause allocated by DOS *)
  1392.   ArgLong        * = UNTRACED POINTER TO ARRAY 1 OF LONGINT;   (* /N *)
  1393.   ArgLongArray   * = UNTRACED POINTER TO ARRAY maxMultiArgs OF ArgLong;   (* /M/N*)
  1394.   ArgBool        * = e.LONGBOOL;   (* /S, /T *)
  1395.   ArgString      * = e.LSTRPTR;    (* /K, or nothing *)
  1396.   ArgStringArray * = UNTRACED POINTER TO ARRAY maxMultiArgs OF ArgString; (* /K/M, /M *)
  1397.  
  1398.  
  1399. CONST
  1400. (* Modes for LockRecord/LockRecords() *)
  1401.   recExclusive       * = 0;
  1402.   recExclusiveImmed  * = 1;
  1403.   recShared          * = 2;
  1404.   recSharedImmed     * = 3;
  1405.  
  1406. TYPE
  1407.  
  1408. (* struct to be passed to LockRecords()/UnLockRecords() *)
  1409.  
  1410.   RecordLock * = STRUCT
  1411.     fh     * : FileHandlePtr; (* filehandle *)
  1412.     offset * : LONGINT;       (* offset in file *)
  1413.     lenght * : LONGINT;       (* length of file to be locked *)
  1414.     mode   * : LONGINT;       (* Type of lock *)
  1415.   END;
  1416.  
  1417. CONST
  1418.  
  1419. (* types for SetVBuf *)
  1420.   bufLine     * = 0;      (* flush on \n, etc *)
  1421.   bufFull     * = 1;      (* never flush except when needed *)
  1422.   bufNone     * = 2;      (* no buffering *)
  1423.  
  1424.  
  1425. (* the structure in the pr_LocalVars list *)
  1426. (* Do NOT allocate yourself, use SetVar()!!! This structure may grow in *)
  1427. (* future releases!  The list should be left in alphabetical order, and *)
  1428. (* may have multiple entries with the same name but different types.    *)
  1429.  
  1430. TYPE
  1431.   LocalVar * = STRUCT (node * : e.Node)
  1432.     flags * : SET;
  1433.     value * : e.LSTRPTR;
  1434.     len   * : LONGINT;
  1435.   END;
  1436.  
  1437. (*
  1438.  * The lv_Flags bits are available to the application.  The unused
  1439.  * lv_Node.ln_Pri bits are reserved for system use.
  1440.  *)
  1441.  
  1442. CONST
  1443.  
  1444. (* definitions for LocalVar.node.type: *)
  1445.   var        * = 0;       (* an variable *)
  1446.   alias      * = 1;       (* an alias    *)
  1447. (* to be or'ed into type: *)
  1448.   ingnore    * = -80H;    (* ignore this entry on GetVar, etc *)
  1449.  
  1450. (* definitions of flags passed to GetVar()/SetVar()/DeleteVar() *)
  1451. (* bit defs to be OR'ed with the type: *)
  1452. (* item will be treated as a single line of text unless BINARY_VAR is used *)
  1453.   globalOnly      * = 8;
  1454.   localOnly       * = 9;
  1455.   binaryVar       * = 10;             (* treat variable as binary *)
  1456.   dontNullTerm    * = 11;      (* only with GVF_BINARY_VAR *)
  1457.  
  1458. (* this is only supported in >= V39 dos.  V37 dos ignores this. *)
  1459. (* this causes SetVar to affect ENVARC: as well as ENV:.      *)
  1460.   saveVar         * = 12;      (* only with GVF_GLOBAL_VAR *)
  1461.  
  1462. TYPE
  1463.   OwnerInfo * = STRUCT (* dummy for better access on SetOwner etc.*)
  1464.     uid *: INTEGER;
  1465.     gid *: INTEGER;
  1466.   END;
  1467.  
  1468. VAR
  1469.   dos*, base*: DosLibraryPtr;   (* synonyms *)
  1470.  
  1471.  
  1472. PROCEDURE Open          *{dos,- 30}(name{1}      : ARRAY OF CHAR;
  1473.                                     accessMode{2}: LONGINT): FileHandlePtr;
  1474. PROCEDURE Close         *{dos,- 36}(file{1}      : FileHandlePtr): BOOLEAN;
  1475. PROCEDURE OldClose      *{dos,- 36}(file{1}      : FileHandlePtr);      (* Version < 36 *)
  1476. PROCEDURE Read          *{dos,- 42}(file{1}      : FileHandlePtr;
  1477.                                     buffer{2}    : ARRAY OF y.BYTE;
  1478.                                     length{3}    : LONGINT): LONGINT;
  1479. PROCEDURE Write         *{dos,- 48}(file{1}      : FileHandlePtr;
  1480.                                     buffer{2}    : ARRAY OF y.BYTE;
  1481.                                     length{3}    : LONGINT): LONGINT;
  1482. PROCEDURE Input         *{dos,- 54}(): FileHandlePtr;
  1483. PROCEDURE Output        *{dos,- 60}(): FileHandlePtr;
  1484. PROCEDURE Seek          *{dos,- 66}(file{1}      : FileHandlePtr;
  1485.                                     position{2}  : LONGINT;
  1486.                                     offset{3}    : LONGINT): LONGINT;
  1487. PROCEDURE DeleteFile    *{dos,- 72}(name{1}      : ARRAY OF CHAR): BOOLEAN;
  1488. PROCEDURE Rename        *{dos,- 78}(oldName{1}   : ARRAY OF CHAR;
  1489.                                     newName{2}   : ARRAY OF CHAR): BOOLEAN;
  1490. PROCEDURE Lock          *{dos,- 84}(name{1}      : ARRAY OF CHAR;
  1491.                                     type{2}      : LONGINT): FileLockPtr;
  1492. PROCEDURE UnLock        *{dos,- 90}(lock{1}      : FileLockPtr);
  1493. PROCEDURE DupLock       *{dos,- 96}(lock{1}      : FileLockPtr): FileLockPtr;
  1494. PROCEDURE Examine       *{dos,-102}(lock{1}      : FileLockPtr;
  1495.                                     VAR info{2}  : FileInfoBlock): BOOLEAN;
  1496. PROCEDURE ExNext        *{dos,-108}(lock{1}      : FileLockPtr;
  1497.                                     VAR info{2}  : FileInfoBlock): BOOLEAN;
  1498. PROCEDURE Info          *{dos,-114}(lock{1}      : FileLockPtr;
  1499.                                     VAR info{2}  : InfoData): BOOLEAN;
  1500. PROCEDURE CreateDir     *{dos,-120}(name{1}      : ARRAY OF CHAR): FileLockPtr;
  1501. PROCEDURE CurrentDir    *{dos,-126}(lock{1}      : FileLockPtr): FileLockPtr;
  1502. PROCEDURE IoErr         *{dos,-132}(): LONGINT;
  1503. PROCEDURE CreateProc    *{dos,-138}(name{1}      : ARRAY OF CHAR;
  1504.                                     pri{2}       : LONGINT;
  1505.                                     segList{3}   : e.BPTR;
  1506.                                     stackSize{4} : LONGINT): ProcessId;
  1507. PROCEDURE Exit          *{dos,-144}(returnCode{1}: LONGINT);
  1508. PROCEDURE LoadSeg       *{dos,-150}(name{1}      : ARRAY OF CHAR): e.BPTR;
  1509. PROCEDURE UnLoadSeg     *{dos,-156}(segList{1}   : e.BPTR);
  1510. PROCEDURE DeviceProc    *{dos,-174}(name{1}      : ARRAY OF CHAR): ProcessId;
  1511. PROCEDURE SetComment    *{dos,-180}(name{1}      : ARRAY OF CHAR;
  1512.                                     comment{2}   : ARRAY OF CHAR): BOOLEAN;
  1513. PROCEDURE SetProtection *{dos,-186}(name{1}      : ARRAY OF CHAR;
  1514.                                     protect{2}   : LONGSET): BOOLEAN;
  1515. PROCEDURE DateStamp     *{dos,-192}(VAR date{1}  : Date);
  1516. PROCEDURE Delay         *{dos,-198}(timeout{1}   : LONGINT);
  1517. PROCEDURE WaitForChar   *{dos,-204}(file{1}      : FileHandlePtr;
  1518.                                     timeout{2}   : LONGINT): BOOLEAN;
  1519. PROCEDURE ParentDir     *{dos,-210}(lock{1}      : FileLockPtr): FileLockPtr;
  1520. PROCEDURE IsInteractive *{dos,-216}(file{1}      : FileHandlePtr): BOOLEAN;
  1521. PROCEDURE Execute       *{dos,-222}(string{1}    : ARRAY OF CHAR;
  1522.                                     file{2}      : FileHandlePtr;
  1523.                                     file2{3}     : FileHandlePtr): BOOLEAN;
  1524.  
  1525. (* ---   functions in V36 or higher (Release 2.0)    --- *)
  1526.  
  1527. (*      DOS Object creation/deletion *)
  1528. PROCEDURE AllocDosObject*{dos,-228}(type{1}      : LONGINT;
  1529.                                     tags{2}      : ARRAY OF u.TagItem): e.APTR;
  1530. PROCEDURE AllocDosObjectTags*{dos,-228}(type{1}  : LONGINT;
  1531.                                     tag1{2}..    : u.Tag): e.APTR;
  1532. PROCEDURE FreeDosObject *{dos,-234}(type{1}      : LONGINT;
  1533.                                     ptr{2}       : e.APTR);
  1534. (*      Packet Level routines *)
  1535. PROCEDURE DoPkt0        *{dos,-240}(port{1}      : ProcessId;
  1536.                                     action{2}    : LONGINT): LONGINT;
  1537. PROCEDURE DoPkt1        *{dos,-240}(port{1}      : ProcessId;
  1538.                                     action{2}    : LONGINT;
  1539.                                     arg1{3}      : LONGINT): LONGINT;
  1540. PROCEDURE DoPkt2        *{dos,-240}(port{1}      : ProcessId;
  1541.                                     action{2}    : LONGINT;
  1542.                                     arg1{3}      : LONGINT;
  1543.                                     arg2{4}      : LONGINT): LONGINT;
  1544. PROCEDURE DoPkt3        *{dos,-240}(port{1}      : ProcessId;
  1545.                                     action{2}    : LONGINT;
  1546.                                     arg1{3}      : LONGINT;
  1547.                                     arg2{4}      : LONGINT;
  1548.                                     arg3{5}      : LONGINT): LONGINT;
  1549. PROCEDURE DoPkt4        *{dos,-240}(port{1}      : ProcessId;
  1550.                                     action{2}    : LONGINT;
  1551.                                     arg1{3}      : LONGINT;
  1552.                                     arg2{4}      : LONGINT;
  1553.                                     arg3{5}      : LONGINT;
  1554.                                     arg4{6}      : LONGINT): LONGINT;
  1555. PROCEDURE DoPkt         *{dos,-240}(port{1}      : ProcessId;
  1556.                                     action{2}    : LONGINT;
  1557.                                     arg1{3}      : LONGINT;
  1558.                                     arg2{4}      : LONGINT;
  1559.                                     arg3{5}      : LONGINT;
  1560.                                     arg4{6}      : LONGINT;
  1561.                                     arg5{7}      : LONGINT): LONGINT;
  1562. PROCEDURE SendPkt       *{dos,-246}(VAR dp{1}    : DosPacket;
  1563.                                     port{2}      : ProcessId;
  1564.                                     replyport{3} : e.MsgPortPtr);
  1565. PROCEDURE WaitPkt       *{dos,-252}(): DosPacketPtr;
  1566. PROCEDURE ReplyPkt      *{dos,-258}(dp{1}        : DosPacketPtr;
  1567.                                     res1{2}      : LONGINT;
  1568.                                     res2{3}      : LONGINT);
  1569. PROCEDURE AbortPkt      *{dos,-264}(port{1}      : ProcessId;
  1570.                                     pkt{2}       : DosPacketPtr);
  1571. (*      Record Locking *)
  1572. PROCEDURE LockRecord    *{dos,-270}(fh{1}        : FileHandlePtr;
  1573.                                     offset{2}    : LONGINT;
  1574.                                     length{3}    : LONGINT;
  1575.                                     mode{4}      : LONGINT;
  1576.                                     timeout{5}   : LONGINT): BOOLEAN;
  1577. PROCEDURE LockRecords   *{dos,-276}(recArray{1}  : RecordLockPtr;
  1578.                                     timeout{2}   : LONGINT): BOOLEAN;
  1579. PROCEDURE UnLockRecord  *{dos,-282}(fh{1}        : FileHandlePtr;
  1580.                                     offset{2}    : LONGINT;
  1581.                                     length{3}    : LONGINT): BOOLEAN;
  1582. PROCEDURE UnLockRecords *{dos,-288}(recArray{1}  : RecordLockPtr): BOOLEAN;
  1583. (*      Buffered File I/O *)
  1584. PROCEDURE SelectInput   *{dos,-294}(fh{1}        : FileHandlePtr): FileHandlePtr;
  1585. PROCEDURE SelectOutput  *{dos,-300}(fh{1}        : FileHandlePtr): FileHandlePtr;
  1586. PROCEDURE FGetC         *{dos,-306}(fh{1}        : FileHandlePtr): LONGINT;
  1587. PROCEDURE FPutC         *{dos,-312}(fh{1}        : FileHandlePtr;
  1588.                                     ch{2}        : LONGINT): LONGINT;
  1589. PROCEDURE UnGetC        *{dos,-318}(fh{1}        : FileHandlePtr;
  1590.                                     character{2} : LONGINT): LONGINT;
  1591. PROCEDURE FRead         *{dos,-324}(fh{1}        : FileHandlePtr;
  1592.                                     block{2}     : ARRAY OF y.BYTE;
  1593.                                     blocklen{3}  : LONGINT;
  1594.                                     number{4}    : LONGINT): LONGINT;
  1595. PROCEDURE FWrite        *{dos,-330}(fh{1}        : FileHandlePtr;
  1596.                                     block{2}     : ARRAY OF y.BYTE;
  1597.                                     blocklen{3}  : LONGINT;
  1598.                                     number{4}    : LONGINT): LONGINT;
  1599. PROCEDURE FGets         *{dos,-336}(fh{1}        : FileHandlePtr;
  1600.                                     VAR buf{2}   : ARRAY OF CHAR;
  1601.                                     buflen{3}    : LONGINT): e.APTR;
  1602. PROCEDURE FPuts         *{dos,-342}(fh{1}        : FileHandlePtr;
  1603.                                     str{2}       : ARRAY OF CHAR): BOOLEAN;
  1604. PROCEDURE VFWritef      *{dos,-348}(fh{1}        : FileHandlePtr;
  1605.                                     format{2}    : ARRAY OF CHAR;
  1606.                                     argarray{3}  : ARRAY OF y.BYTE): LONGINT;
  1607. PROCEDURE FWritef       *{dos,-348}(fh{1}        : FileHandlePtr;
  1608.                                     format{2}    : ARRAY OF CHAR;
  1609.                                     arg1{3}..    : e.APTR): LONGINT;
  1610. PROCEDURE VFPrintf      *{dos,-354}(fh{1}        : FileHandlePtr;
  1611.                                     format{2}    : ARRAY OF CHAR;
  1612.                                     argarray{3}  : ARRAY OF e.APTR): LONGINT;
  1613. PROCEDURE FPrintf       *{dos,-354}(fh{1}        : FileHandlePtr;
  1614.                                     format{2}    : ARRAY OF CHAR;
  1615.                                     arg1{3}..    : e.APTR): LONGINT;
  1616. PROCEDURE Flush         *{dos,-360}(fh{1}        : FileHandlePtr): BOOLEAN;
  1617. PROCEDURE SetVBuf       *{dos,-366}(fh{1}        : FileHandlePtr;
  1618.                                     VAR buff{2}  : ARRAY OF CHAR;
  1619.                                     type{3}      : LONGINT;
  1620.                                     size{4}      : LONGINT): LONGINT;
  1621. (*      DOS Object Management *)
  1622. PROCEDURE DupLockFromFH *{dos,-372}(fh{1}        : FileHandlePtr): FileLockPtr;
  1623. PROCEDURE OpenFromLock  *{dos,-378}(lock{1}      : FileLockPtr): FileHandlePtr;
  1624. PROCEDURE ParentOfFH    *{dos,-384}(fh{1}        : FileHandlePtr): FileLockPtr;
  1625. PROCEDURE ExamineFH     *{dos,-390}(fh{1}        : FileHandlePtr;
  1626.                                     VAR fib{2}   : FileInfoBlock): BOOLEAN;
  1627. PROCEDURE SetFileDate   *{dos,-396}(name{1}      : ARRAY OF CHAR;
  1628.                                     date{2}      : Date): BOOLEAN;
  1629. PROCEDURE NameFromLock  *{dos,-402}(lock{1}      : FileLockPtr;
  1630.                                     VAR buffer{2}: ARRAY OF CHAR;
  1631.                                     len{3}       : LONGINT): BOOLEAN;
  1632. PROCEDURE NameFromFH    *{dos,-408}(fh{1}        : FileHandlePtr;
  1633.                                     VAR buffer{2}: ARRAY OF CHAR;
  1634.                                     len{3}       : LONGINT): BOOLEAN;
  1635. PROCEDURE SplitName     *{dos,-414}(name{1}      : ARRAY OF CHAR;
  1636.                                     seperator{2} : CHAR;
  1637.                                     buf{3}       : ARRAY OF CHAR;
  1638.                                     oldpos{4}    : LONGINT;
  1639.                                     size{5}      : LONGINT): INTEGER;
  1640. PROCEDURE SameLock      *{dos,-420}(lock1{1}     : FileLockPtr;
  1641.                                     lock2{2}     : FileLockPtr): INTEGER;
  1642. PROCEDURE SetMode       *{dos,-426}(fh{1}        : FileHandlePtr;
  1643.                                     mode{2}      : LONGINT): BOOLEAN;
  1644. PROCEDURE ExAll         *{dos,-432}(lock{1}      : FileLockPtr;
  1645.                                     buffer{2}    : ARRAY OF y.BYTE;
  1646.                                     size{3}      : LONGINT;
  1647.                                     data{4}      : LONGINT;
  1648.                                     ctrl{5}      : ExAllControlPtr): BOOLEAN;
  1649. PROCEDURE ReadLink      *{dos,-438}(port{1}      : ProcessId;
  1650.                                     lock{2}      : FileLockPtr;
  1651.                                     path{3}      : ARRAY OF CHAR;
  1652.                                     buffer{4}    : ARRAY OF CHAR;
  1653.                                     size{5}      : LONGINT): LONGINT;
  1654. PROCEDURE MakeLink      *{dos,-444}(name{1}      : ARRAY OF CHAR;
  1655.                                     dest{2}      : LONGINT;
  1656.                                     soft{3}      : LONGINT): LONGINT;
  1657. PROCEDURE ChangeMode    *{dos,-450}(type{1}      : LONGINT; (* must be changeFH *)
  1658.                                     fh{2}        : FileHandlePtr;
  1659.                                     newmode{3}   : LONGINT): BOOLEAN;
  1660. PROCEDURE ChangeModeLock*{dos,-450}(type{1}      : LONGINT; (* must be changeLock *)
  1661.                                     lock{2}      : FileLockPtr;
  1662.                                     newmode{3}   : LONGINT): BOOLEAN;
  1663. PROCEDURE SetFileSize   *{dos,-456}(fh{1}        : FileHandlePtr;
  1664.                                     pos{2}       : LONGINT;
  1665.                                     mode{3}      : LONGINT): LONGINT;
  1666. (*      Error Handling *)
  1667. PROCEDURE SetIoErr      *{dos,-462}(result{1}    : LONGINT): LONGINT;
  1668. PROCEDURE Fault         *{dos,-468}(code{1}      : LONGINT;
  1669.                                     header{2}    : ARRAY OF CHAR;
  1670.                                     VAR buffer{3}: ARRAY OF CHAR;
  1671.                                     len{4}       : LONGINT): LONGINT;
  1672. PROCEDURE PrintFault    *{dos,-474}(code{1}      : LONGINT;
  1673.                                     header{2}    : ARRAY OF CHAR): BOOLEAN;
  1674. PROCEDURE ErrorReport   *{dos,-480}(code{1}      : LONGINT;
  1675.                                     type{2}      : LONGINT;   (* should be reportVolume *)
  1676.                                     arg1{3}      : DeviceListAPtr;
  1677.                                     device{4}    : ProcessId): LONGINT;
  1678. PROCEDURE ErrorReportLock*{dos,-480}(code{1}      : LONGINT;
  1679.                                     type{2}      : LONGINT;   (* should be reportLock *)
  1680.                                     arg1{3}      : FileLockPtr;
  1681.                                     device{4}    : ProcessId): LONGINT;
  1682. PROCEDURE ErrorReportFH *{dos,-480}(code{1}      : LONGINT;
  1683.                                     type{2}      : LONGINT;   (* should be reportStream *)
  1684.                                     arg1{3}      : FileHandlePtr;
  1685.                                     device{4}    : ProcessId): LONGINT;
  1686. PROCEDURE Requester     *{dos,-486}(s1{1}        : ARRAY OF CHAR;
  1687.                                     s2{2}        : ARRAY OF CHAR;
  1688.                                     s3{3}        : ARRAY OF CHAR;
  1689.                                     flags{4}     : LONGSET): LONGINT;
  1690. (*      Process Management *)
  1691. PROCEDURE Cli           *{dos,-492}(): CommandLineInterfaceAPtr;
  1692. PROCEDURE CreateNewProc *{dos,-498}(tags{1}      : ARRAY OF u.TagItem): ProcessPtr;
  1693. PROCEDURE CreateNewProcTags*{dos,-498}(tag1{1}.. : u.Tag): ProcessPtr;
  1694. PROCEDURE RunCommand    *{dos,-504}(seg{1}       : e.BPTR;
  1695.                                     stack{2}     : LONGINT;
  1696.                                     paramptr{3}  : ARRAY OF CHAR;
  1697.                                     paramlen{4}  : LONGINT): LONGINT;
  1698. PROCEDURE GetConsoleTask*{dos,-510}(): ProcessId ;
  1699. PROCEDURE SetConsoleTask*{dos,-516}(task{1}      : ProcessId): ProcessId;
  1700. PROCEDURE GetFileSysTask*{dos,-522}(): ProcessId;
  1701. PROCEDURE SetFileSysTask*{dos,-528}(task{1}      : ProcessId): ProcessId;
  1702. PROCEDURE GetArgStr     *{dos,-534}(): e.LSTRPTR;
  1703. PROCEDURE SetArgStr     *{dos,-540}(string{1}    : ARRAY OF CHAR): e.LSTRPTR;
  1704. PROCEDURE FindCliProc   *{dos,-546}(num{1}       : LONGINT): ProcessPtr;
  1705. PROCEDURE MaxCli        *{dos,-552}(): LONGINT;
  1706. PROCEDURE SetCurrentDirName*{dos,-558}(name{1}   : ARRAY OF CHAR): BOOLEAN;
  1707. PROCEDURE GetCurrentDirName*{dos,-564}(VAR buf{1}: ARRAY OF CHAR;
  1708.                                        len{2}    : LONGINT): BOOLEAN;
  1709. PROCEDURE SetProgramName*{dos,-570}(name{1}      : ARRAY OF CHAR): BOOLEAN;
  1710. PROCEDURE GetProgramName*{dos,-576}(VAR buf{1}   : ARRAY OF CHAR;
  1711.                                     len{2}       : LONGINT): BOOLEAN;
  1712. PROCEDURE SetPrompt     *{dos,-582}(name{1}      : ARRAY OF CHAR): BOOLEAN;
  1713. PROCEDURE GetPrompt     *{dos,-588}(VAR buf{1}   : ARRAY OF CHAR;
  1714.                                     len{2}       : LONGINT): BOOLEAN;
  1715. PROCEDURE SetProgramDir *{dos,-594}(lock{1}      : FileLockPtr): FileLockPtr;
  1716. PROCEDURE GetProgramDir *{dos,-600}(): FileLockPtr;
  1717. (*      Device List Management *)
  1718. PROCEDURE System        *{dos,-606}(command{1}   : ARRAY OF CHAR;
  1719.                                     tags{2}      : ARRAY OF u.TagItem): LONGINT;
  1720. PROCEDURE SystemTags    *{dos,-606}(command{1}   : ARRAY OF CHAR;
  1721.                                     tag1{2}..    : u.Tag): LONGINT;
  1722. PROCEDURE AssignLock    *{dos,-612}(name{1}      : ARRAY OF CHAR;
  1723.                                     lock{2}      : FileLockPtr): BOOLEAN;
  1724. PROCEDURE AssignLate    *{dos,-618}(name{1}      : ARRAY OF CHAR;
  1725.                                     path{2}      : ARRAY OF CHAR): BOOLEAN;
  1726. PROCEDURE AssignPath    *{dos,-624}(name{1}      : ARRAY OF CHAR;
  1727.                                     path{2}      : ARRAY OF CHAR): BOOLEAN;
  1728. PROCEDURE AssignAdd     *{dos,-630}(name{1}      : ARRAY OF CHAR;
  1729.                                     lock{2}      : FileLockPtr): BOOLEAN;
  1730. PROCEDURE RemAssignList *{dos,-636}(name{1}      : ARRAY OF CHAR;
  1731.                                     lock{2}      : FileLockPtr): LONGINT;
  1732. PROCEDURE GetDeviceProc *{dos,-642}(name{1}      : ARRAY OF CHAR;
  1733.                                     dp{2}        : DevProcPtr): DevProcPtr;
  1734. PROCEDURE FreeDeviceProc*{dos,-648}(dp{1}        : DevProcPtr);
  1735. PROCEDURE LockDosList   *{dos,-654}(flags{1}     : LONGSET): DosListNodePtr;
  1736. PROCEDURE UnLockDosList *{dos,-660}(flags{1}     : LONGSET);
  1737. PROCEDURE AttemptLockDosList*{dos,-666}(flags{1} : LONGSET): DosListNodePtr;
  1738. PROCEDURE RemDosEntry   *{dos,-672}(dlist{1}     : DosListNodePtr): BOOLEAN;
  1739. PROCEDURE AddDosEntry   *{dos,-678}(dlist{1}     : DosListNodePtr): DosListNodePtr;
  1740. PROCEDURE FindDosEntry  *{dos,-684}(dlist{1}     : DosListNodePtr;
  1741.                                     name{2}      : ARRAY OF CHAR;
  1742.                                     flags{3}     : LONGSET): DosListNodePtr;
  1743. PROCEDURE NextDosEntry  *{dos,-690}(dlist{1}     : DosListNodePtr;
  1744.                                     flags{2}     : LONGSET): DosListNodePtr;
  1745. PROCEDURE MakeDosEntry  *{dos,-696}(name{1}      : ARRAY OF CHAR;
  1746.                                     type{2}      : LONGINT): DosListNodePtr;
  1747. PROCEDURE FreeDosEntry  *{dos,-702}(dlist{1}     : DosListNodePtr);
  1748. PROCEDURE IsFileSystem  *{dos,-708}(name{1}      : ARRAY OF CHAR): BOOLEAN;
  1749. (*      Handler Interface *)
  1750. PROCEDURE Format        *{dos,-714}(filesystem{1}: ARRAY OF CHAR;
  1751.                                     volumename{2}: ARRAY OF CHAR;
  1752.                                     dostype{3}   : LONGINT): BOOLEAN;
  1753. PROCEDURE Relabel       *{dos,-720}(drive{1}     : ARRAY OF CHAR;
  1754.                                     newname{2}   : ARRAY OF CHAR): BOOLEAN;
  1755. PROCEDURE Inhibit       *{dos,-726}(name{1}      : ARRAY OF CHAR;
  1756.                                     onoff{2}     : LONGINT): BOOLEAN;
  1757. PROCEDURE AddBuffers    *{dos,-732}(name{1}      : ARRAY OF CHAR;
  1758.                                     number{2}    : LONGINT): LONGINT;
  1759. (*      Date, Time Routines *)
  1760. PROCEDURE CompareDates  *{dos,-738}(date1{1}     : Date;
  1761.                                     date2{2}     : Date): LONGINT;
  1762. PROCEDURE DateToStr     *{dos,-744}(VAR dt{1}    : DateTime): BOOLEAN;
  1763. PROCEDURE StrToDate     *{dos,-750}(VAR dt{1}    : DateTime): BOOLEAN;
  1764. (*      Image Management *)
  1765. PROCEDURE InternalLoadSeg*{dos,-756}(fh{1}       : FileHandlePtr;
  1766.                                     table{2}     : e.BPTR;
  1767.                                     funcarray{9} : e.APTR;
  1768.                                     VAR stack{10}: LONGINT): e.BPTR;
  1769. PROCEDURE InternalUnLoadSeg*{dos,-762}(seglist{1}: e.BPTR;
  1770.                                     freefunc{9}  : e.PROC): BOOLEAN;
  1771. PROCEDURE NewLoadSeg    *{dos,-768}(file{1}      : ARRAY OF CHAR;
  1772.                                     tags{2}      : ARRAY OF u.TagItem): e.BPTR;
  1773. PROCEDURE NewLoadSegTags*{dos,-768}(file{1}      : ARRAY OF CHAR;
  1774.                                     tags{2}..    : u.Tag): e.BPTR;
  1775. PROCEDURE AddSegment    *{dos,-774}(name{1}      : ARRAY OF CHAR;
  1776.                                     seg{2}       : e.BPTR;
  1777.                                     system{3}    : LONGINT): BOOLEAN;
  1778. PROCEDURE FindSegment   *{dos,-780}(name{1}      : ARRAY OF CHAR;
  1779.                                     seg{2}       : SegmentPtr;
  1780.                                     system{3}    : LONGINT): SegmentPtr;
  1781. PROCEDURE RemSegment    *{dos,-786}(seg{1}       : SegmentPtr): BOOLEAN;
  1782. (*      Command Support *)
  1783. PROCEDURE CheckSignal   *{dos,-792}(mask{1}      : LONGSET): LONGSET;
  1784. PROCEDURE OldReadArgs   *{dos,-798}(template{1}  : ARRAY OF CHAR;
  1785.                                     VAR array{2} : ARRAY OF y.BYTE;
  1786.                                     args{3}      : RDArgsPtr): RDArgsPtr;
  1787. PROCEDURE ReadArgs      *{dos,-798}(template{1}  : ARRAY OF CHAR;
  1788.                                     VAR array{2} : ArgsStruct;
  1789.                                     args{3}      : RDArgsPtr): RDArgsPtr;
  1790. PROCEDURE FindArg       *{dos,-804}(template{1}  : ARRAY OF CHAR;
  1791.                                     keyword{2}   : ARRAY OF CHAR): LONGINT;
  1792. PROCEDURE ReadItem      *{dos,-810}(VAR name{1}  : ARRAY OF CHAR;
  1793.                                     maxchars{2}  : LONGINT;
  1794.                                     cSrc{3}      : CSourcePtr): LONGINT;
  1795. PROCEDURE StrToLong     *{dos,-816}(string{1}    : ARRAY OF CHAR;
  1796.                                     VAR value{2} : LONGINT): LONGINT;
  1797. PROCEDURE MatchFirst    *{dos,-822}(pat{1}       : ARRAY OF CHAR;
  1798.                                     VAR anchor{2}: AnchorPath): LONGINT;
  1799. PROCEDURE MatchNext     *{dos,-828}(VAR anchor{1}: AnchorPath): LONGINT;
  1800. PROCEDURE MatchEnd      *{dos,-834}(VAR anchor{1}: AnchorPath);
  1801. PROCEDURE ParsePattern  *{dos,-840}(pat{1}       : ARRAY OF CHAR;
  1802.                                     VAR buf{2}   : ARRAY OF CHAR;
  1803.                                     buflen{3}    : LONGINT): INTEGER;
  1804. PROCEDURE MatchPattern  *{dos,-846}(pat{1}       : ARRAY OF CHAR;
  1805.                                     str{2}       : ARRAY OF CHAR): BOOLEAN;
  1806. PROCEDURE FreeArgs      *{dos,-858}(args{1}      : RDArgsPtr);
  1807. PROCEDURE FilePart      *{dos,-870}(path{1}      : ARRAY OF CHAR): e.LSTRPTR;
  1808. PROCEDURE PathPart      *{dos,-876}(path{1}      : ARRAY OF CHAR): e.APTR;
  1809. PROCEDURE AddPart       *{dos,-882}(VAR dir{1}   : ARRAY OF CHAR;
  1810.                                     filename{2}  : ARRAY OF CHAR;
  1811.                                     size{3}      : LONGINT): BOOLEAN;
  1812. (*      Notification *)
  1813. PROCEDURE StartNotify   *{dos,-888}(VAR notify{1}: NotifyRequest): BOOLEAN;
  1814. PROCEDURE EndNotify     *{dos,-894}(VAR nofify{1}: NotifyRequest);
  1815. (*      Environment Variable functions *)
  1816. PROCEDURE SetVar        *{dos,-900}(name{1}      : ARRAY OF CHAR;
  1817.                                     buffer{2}    : ARRAY OF CHAR;
  1818.                                     size{3}      : LONGINT;
  1819.                                     flags{4}     : LONGSET): BOOLEAN;
  1820. PROCEDURE GetVar        *{dos,-906}(name{1}      : ARRAY OF CHAR;
  1821.                                     VAR buffer{2}: ARRAY OF CHAR;
  1822.                                     size{3}      : LONGINT;
  1823.                                     flags{4}     : LONGSET): LONGINT;
  1824. PROCEDURE DeleteVar     *{dos,-912}(name{1}      : ARRAY OF CHAR;
  1825.                                     flags{2}     : LONGSET): BOOLEAN;
  1826. PROCEDURE FindVar       *{dos,-918}(name{1}      : ARRAY OF CHAR;
  1827.                                     type{2}      : LONGSET): LocalVarPtr;
  1828. PROCEDURE CliInit       *{dos,-924}(VAR dp{8}    : DosPacket): LONGINT;
  1829. PROCEDURE CliInitNewcli *{dos,-930}(VAR dp{8}    : DosPacket): LONGINT;
  1830. PROCEDURE CliInitRun    *{dos,-936}(VAR dp{8}    : DosPacket): LONGINT;
  1831. PROCEDURE WriteChars    *{dos,-942}(buf{1}       : ARRAY OF CHAR;
  1832.                                     buflen{2}    : LONGINT): LONGINT;
  1833. PROCEDURE PutStr        *{dos,-948}(str{1}       : ARRAY OF CHAR): LONGINT;
  1834. PROCEDURE VPrintf       *{dos,-954}(format{1}    : ARRAY OF CHAR;
  1835.                                     argarray{2}  : ARRAY OF y.BYTE): LONGINT;
  1836. PROCEDURE Printf        *{dos,-954}(format{1}    : ARRAY OF CHAR;
  1837.                                     arg1{2}..    : e.APTR): LONGINT;
  1838. PROCEDURE PrintF        *{dos,-954}(format{1}    : ARRAY OF CHAR;
  1839.                                     arg1{2}..    : e.APTR); (* result is ignored *)
  1840. (* these were unimplemented until dos 36.147 *)
  1841. PROCEDURE ParsePatternNoCase*{dos,-966}(pat{1}   : ARRAY OF CHAR;
  1842.                                     VAR buf{2}   : ARRAY OF CHAR;
  1843.                                     len{3}       : LONGINT): INTEGER;
  1844. PROCEDURE MatchPatternNoCase*{dos,-972}(pat{1}   : ARRAY OF CHAR;
  1845.                                     str{2}       : ARRAY OF CHAR): BOOLEAN;
  1846. (* this was added for V37 dos, returned 0 before then. *)
  1847. PROCEDURE SameDevice    *{dos,-984}(lock1{1}     : FileLockPtr;
  1848.                                     lock2{2}     : FileLockPtr): BOOLEAN;
  1849.  
  1850. (* NOTE: the following entries did NOT exist before ks 36.303 (2.02) *)
  1851. (* If you are going to use them, open dos.library with version 37 *)
  1852.  
  1853. (* These calls were added for V39 dos: *)
  1854. PROCEDURE ExAllEnd      *{dos,-3DEH}(lock{1}     : FileLockPtr;
  1855.                                     buffer{2}    : ARRAY OF y.BYTE;
  1856.                                     size{3}      : LONGINT;
  1857.                                     data{4}      : LONGINT;
  1858.                                     ctrl{5}      : ExAllControlPtr);
  1859. PROCEDURE SetOwner      *{dos,-3E4H}(name{1}     : ARRAY OF CHAR;
  1860.                                      ownerInfo{2}: OwnerInfo): BOOLEAN;
  1861.  
  1862.  
  1863. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
  1864.  
  1865. PROCEDURE ReadChar*(): CHAR;
  1866. VAR c: LONGINT;
  1867. BEGIN
  1868.   c := FGetC(Input()); IF (c<0) OR (c>255) THEN c := 0 END; RETURN CHR(c);
  1869. END ReadChar;
  1870.  
  1871.  
  1872. PROCEDURE WriteChar*(c{2}: CHAR): LONGINT;
  1873. BEGIN RETURN FPutC(Output(),ORD(c)) END WriteChar;
  1874.  
  1875.  
  1876. PROCEDURE UnReadChar*(c{2}: CHAR): LONGINT;
  1877. BEGIN RETURN UnGetC(Input(),ORD(c)); END UnReadChar;
  1878.  
  1879. (* next one is inefficient *)
  1880.  
  1881. PROCEDURE ReadChars*(VAR buf: ARRAY OF y.BYTE; num: LONGINT): LONGINT;
  1882. BEGIN RETURN FRead(Input(),buf,1,num); END ReadChars;
  1883.  
  1884. PROCEDURE ReadLn*(VAR buf: ARRAY OF CHAR; len: LONGINT): e.APTR;
  1885. BEGIN RETURN FGets(Input(),buf,len); END ReadLn;
  1886.  
  1887. PROCEDURE WriteStr*(s: ARRAY OF CHAR): BOOLEAN; (* $CopyArrays- *)
  1888. BEGIN RETURN FPuts(Output(),s); END WriteStr;
  1889.  
  1890. PROCEDURE VWritef*(format: ARRAY OF CHAR; argv: ARRAY OF y.BYTE): LONGINT;
  1891. (* $CopyArrays- *)
  1892. BEGIN RETURN VFWritef(Output(),format,argv); END VWritef;
  1893.  
  1894. (*
  1895.  * The following procedures are implemented for to avoid using SYSTEM within
  1896.  * Oberon programs.
  1897.  *)
  1898.  
  1899. (*
  1900.  * Use this to convert a ProcessId (eg. WBStartup.process) to a ProcessPtr.
  1901.  *)
  1902. PROCEDURE ProcessIdToProcess*(id{8}: ProcessId): ProcessPtr;
  1903. BEGIN RETURN y.VAL(ProcessPtr,y.VAL(LONGINT,id)-SIZE(e.Task)); END ProcessIdToProcess;
  1904.  
  1905. (*
  1906.  * Use this to get a Process' ProcessId, ie. a pointer to its MsgPort.
  1907.  *)
  1908. PROCEDURE ProcessToProcessId*(proc{8}: ProcessPtr): ProcessId;
  1909. BEGIN RETURN y.ADR(proc.msgPort); END ProcessToProcessId;
  1910.  
  1911. BEGIN
  1912.   dos :=  e.OpenLibrary(dosName,33);
  1913.   IF dos = NIL THEN HALT(fail) END;
  1914.   base := dos;
  1915.  
  1916. CLOSE
  1917.   IF dos#NIL THEN e.CloseLibrary(dos) END;
  1918.  
  1919. END Dos.
  1920.  
  1921.